[xslt] question about single quote



Hi,

I have a question about the xslt functions substring-before and
substring-after. I use this xml File:

<?xml version="1.0" encoding="ISO8859-1"?>
<?xml-stylesheet href="http://ap-lnx-ofeige.client/xsl-bin/foo.xsl";
type="text/xsl"?> <doc>Hello 'world'</doc>

I like to do a search and replace to replace the single quote with a
other char. For that I use this xslt function:

<xsl:template name="replace-string">
	<xsl:param name="text"/>
	<xsl:param name="replace"/>
	<xsl:param name="with"/>
	<xsl:choose>
		<xsl:when test="contains($text,$replace)">
			<xsl:value-of
select="substring-before($text,$replace)"/>
			<xsl:value-of select="$with"/>
			<xsl:call-template name="replace-string">
				<xsl:with-param name="text"
select="substring-after($text,$replace)"/>
				<xsl:with-param name="replace"
select="$replace"/>
				<xsl:with-param name="with"
select="$with"/>
			</xsl:call-template>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="$text"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

This function works fine with all Chars except the ' (&apos;). When I do
a 

<xsl:call-template name="replace-string">
	<xsl:with-param name="text" select="normalize-space(/doc)"/>
	<xsl:with-param name="replace" select="'&apos;'"/>
	<xsl:with-param name="with" select="'&quot;'"/>
</xsl:call-template>

I get this Error

Invalid expression '''
Compilation error: file ... element with-param

And so on.

I can introduce myself why this expression wrongly strike. But I have no
answer.


Regards,
Oliver Feige




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]