Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: String Conversion

From: "Joe Fawcett" <joefawcett@---------.------>
To: 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
 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent