[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

outputting ampersand to its actual character

Subject: outputting ampersand to its actual character
From: Carlo Liwanag <cliwanag@xxxxxxxxxxxx>
Date: Tue, 05 Sep 2006 17:38:02 +0800
x00e0
Hi,
I am processing a text file (for each line) in this format:

\0061\00E0=\1F05

\0065\00E0=\1F15

I will then create a variable of type element because I would use it in a find and replace function.
In my variable I have to convert these lines to:
<entry><search>&#x0061;&#x00E0;</search><replace>&#x1F05;</replace></entry>
<entry><search>&#x0065;&#x00E0;</search><replace>&#x1F15;</replace></entry>
and my problem is, whenever is try to replace '\' with an &#x62;#x I end up with &amp;#x


As you know, my find and replace function will not work for that. Is there a work around for this?

Btw, I am using Saxon and XSLT 2.0. Also this is my code:

xsl:variable name="ref_string" as="xs:string*">
<xsl:analyze-string select="unparsed-text('sgreek.txt','utf-8')" regex="[\r\n]">
<xsl:non-matching-substring>
<xsl:value-of select="replace(.,'\\([A-F0-9]{4})','&amp;$1;')"/>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:variable>
<xsl:variable name="sfont" select="substring-before($ref_string[position()=1],' ')"/>
<xsl:variable name="ref">
<xsl:element name="{$sfont}">
<xsl:for-each select="$ref_string">
<xsl:choose>
<xsl:when test="position()=1"/>
<xsl:otherwise>
<xsl:element name="entry">
<xsl:variable name="str1" as="xs:string*" select="tokenize(.,'=')"/>
<xsl:element name="search">
<xsl:value-of select="$str1[1]"/>
</xsl:element>
<xsl:element name="replace">
<xsl:value-of select="$str1[2]"/>
</xsl:element>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:element>
</xsl:variable>


Thanks,
Carlo

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.