Subject: RE: [xsl] outputting ampersand to its actual character From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Tue, 5 Sep 2006 10:55:43 +0100 |
> 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/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] outputting ampersand to its a, Carlo Liwanag | Thread | [xsl] Merging dita files, Shailesh Shinde |
[xsl] outputting ampersand to its a, Carlo Liwanag | Date | [xsl] Merging dita files, Shailesh Shinde |
Month |