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

how-to change &#*****; to &#****;

Subject: how-to change &#*****; to &#****;
From: "Christoph Klocker" <klocker@xxxxxxxxxxxxx>
Date: Tue, 9 Nov 2004 12:23:30 +0100
xsl amp
Hi,

I hope you can help me once again.

I have an ESQL query to our MSSQL database via the JDBC driver, where I
query chinese Unicode characters.
Unfortunately I didn't find an solution to get the unicode characters out of
the database,
so I try a different solution in applying an xsl-transformation and replace
the &amp; with &.
However it doesn't work.

my xml
<categories xmlns:xsp="http://apache.org/xsp"
xmlns:xspdoc="http://apache.org/cocoon/XSPDoc/v1"
	xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<category>
		<FaaLocTextCH>&amp;#32173;&amp;#20063;&amp;#32013;</FaaLocTextCH>
	</category>
	<category>
		<FaaLocTextCH>&amp;#27861;&amp;#34349;&amp;#20811;&amp;</FaaLocTextCH>
	</category>
	<category>
		<FaaLocTextCH>&amp;#32016;&amp;#32004; </FaaLocTextCH>
	</category>
	<category>
		<FaaLocTextCH>&amp;#39321;&amp;#28207;</FaaLocTextCH>
	</category>
	<category>
		<FaaLocTextCH>&amp;#38463;&amp;#22982;&amp;#26031;&amp;</FaaLocTextCH>
	</category>
</categories>

and my stylesheet I try to apply

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<xsl:template match="/categories/category">
		<xsl:call-template name="escape-apos">
			<xsl:with-param name="text" select="." />
		</xsl:call-template>
	</xsl:template>
	<xsl:template name="escape-apos">
		<xsl:param name="text" />
			<xsl:variable name="apos">&amp;</xsl:variable>
		<xsl:choose>
			<xsl:when test="contains($text, $apos)">
				<xsl:value-of select="substring-before($text, $apos)" />
					<xsl:text disable-output-escaping="yes">&amp;</xsl:text>
				<xsl:call-template name="escape-apos">
					<xsl:with-param name="text" select="substring-after($text, $apos)" />
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$text" />
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>

thanks for any suggestion
Christoph

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.