[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: outputting ampersand to its actual character
> In my variable I have to convert these lines to: > <entry><search>aà</search><replace>ἅ</rep > lace></entry> > <entry><search>eà</search><replace>ἕ</rep > lace></entry> > and my problem is, whenever is try to replace '\' with an > b#x I end up with &#x A variable contains a tree of nodes, it doesn't contain lexical XML. I assume you want your first "search" element to contain two characters, the characters with Unicode codepoints x61 and xE0. To achieve that, you want to write those two characters, not some XML markup that an XML parser would convert into those characters. To write these two characters you can use <xsl:value-of select="codepoints-to-string((97, 224))"/> if I've got my sums right. Your stylesheet needs to do the hex-to-decimal conversion: here's a function I wrote to do this: <xsl:function name="f:hex-to-char" as="xs:integer"> <xsl:param name="in"/> <!-- e.g. 030C --> <xsl:sequence select=" if (string-length($in) eq 1) then f:hex-digit-to-integer($in) else 16*f:hex-to-char(substring($in, 1, string-length($in)-1)) + f:hex-digit-to-integer(substring($in, string-length($in)))"/> </xsl:function> <xsl:function name="f:hex-digit-to-integer" as="xs:integer"> <xsl:param name="char"/> <xsl:sequence select="string-length(substring-before('0123456789ABCDEF', $char))"/> </xsl:function> Michael Kay http://www.saxonica.com/
|
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
|