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>aà</search><replace>ἅ</replace></entry>
<entry><search>eà</search><replace>ἕ</replace></entry>
and my problem is, whenever is try to replace '\' with an b#x I end
up with &#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})','&$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