[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Decimal to hexadecimal in one function (XSLT/XPath
Michael Kay wrote:
Something like this perhaps:
<xsl:function name="my:int-to-hex" as="xs:string"> <xsl:param name="in" as="xs:integer"/> <xsl:sequence select="if ($in eq 0) then '0' else concat(if ($in gt 16) then my:int-to-hex($in idiv 16) else '', substring('0123456789ABCDEF', ($in mod 16) + 1, 1))"/> </xsl:function> But what's wrong with having two functions anyway?
Incidentally, do try to get into the habit of declaring your parameter and return types. It helps people reading your code, it helps the compiler, and it helps you.
Yves
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|