[xslt] question about single quote
- From: "Oliver Feige" <oliver feige triplex de>
- To: <xslt gnome org>
- Subject: [xslt] question about single quote
- Date: Tue, 27 Nov 2001 16:32:51 +0100
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 ' ('). 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="'''"/>
<xsl:with-param name="with" select="'"'"/>
</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]