Subject: Re: [xsl] Character substitution From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 10 Jan 2005 10:34:34 GMT |
> Yes that's not really the problem, the problem is that my text() returns nothing, so nothing can be replaced. > I don't think you have posted enough to be able to debug that. Looking back at the start of the thread: ] my xsl: ] -------------------------------------------------------------- ] <xsl:template match="text()"> ] <xsl:call-template name="change" > ] <xsl:with-param name="text" select="."/> ] </xsl:call-template> ] </xsl:template> ] ] <xsl:template name="change"> ] <xsl:param name="text"/> ] <xsl:value-of select="$text"/> ] <xsl:choose> ] <xsl:when test="contains($text, '$')"> ] <xsl:value-of select="substring-before($text, '$')"/> ] € ] <xsl:call-template name="change"> ] <xsl:with-param name="text" select="substring-after($text,'$')"/> ] </xsl:call-template> ] </xsl:when> ] <xsl:otherwise> ] <xsl:value-of select="$text"/> ] </xsl:otherwise> ] </xsl:choose> ] </xsl:template> ] ] -------------------------------------------------------------- ] ] my xml: ] -------------------------------------------------------------- ] <?xml version="1.0" encoding="ISO-8859-15"?> ] <test> ] <header> ] <creation date="2005-01-10" timestamp="1105349670236" user="sven" login="sven" /> ] </header> ] <test-t id="35" > ] <numbering>1</numbering> ] <name><![CDATA[TT$]]></name> ] <path><![CDATA[/TT$]]></path> ] </test-t> ] </test> ] Your input is in ISO-8859-15 in which case (if I remember correctly) $ is the euro character ie it's already character 8364 so it isn't clear what you are tryting to replace. If your template was called, it would replace the $ by a newline, several tabs and spaces, a euro, another newline and several more tabs and spaces. You should always put literal text in xsl:text if you don't want the stylesheet indentation to be copied to the result tree. You haven't shown the encoding declaration for your stylesheet. You use the literal string $ but that could mean anything (depending on the encoding specified in the stylesheet). also you haven't shown your other templates, do you ever apply templates to the text nodes in question? David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Character substitution, Sven Waibel | Thread | Re: [xsl] Character substitution, Jim Fuller |
Re: [xsl] Character substitution, Sven Waibel | Date | Re: [xsl] Character substitution, David Carlisle |
Month |