Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: String Conversion [Thread Next] Re: String ConversionTo: NULL Date: 2/12/2008 8:45:00 AM
"Jean-sébastien LEROY" <jean.sebastien.leroy@c...> wrote in
message news:47b15361$0$21144$7a628cd7@n......
> Something I have forgot :
>
> If someone can give me a solution to have the generate-id() returning a
> decimal value and not an hexadecimal.
>
> "Jean-sébastien LEROY" <jean.sebastien.leroy@c...> a écrit
> dans le message de news:
> 47b15299$0$21144$7a628cd7@n......
>> Hello all,
>>
>> I am new to XLS. I would like to get only the decimal value of a string
>> ID="abcdef_12345" (i.e. having 12345 to put in a new ID)
>>
>> Thank you all
>>
>
>
generate-id can return any value it wants, so long as it's unique within the
document and consistent if called multiple times on the same node. So it
could just return node1, node2... etc.
If you want to convert abcdef_122345 to 12345 then you could use translate
in version 1.0 providing you know all the non-numeric characters. e.g.:
<xsl:variable name="remove" select="'abcde..xyz_'" />
translate("abcde_12345", $remove, "") will give you 12345, you can wrap this
in the number() function if necessary.
In XSLT 2.0 you can use the regular expression support to create a function
that removes any non-digit.
--
Joe Fawcett (MVP - XML)
http://joe.fawcett.name
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
