Subject: Re: encoding $ character for wml output via xsl:value-of From: Stephen Zisk <szisk@xxxxxxxxxxxxxxx> Date: Fri, 01 Sep 2000 15:23:36 -0400 |
WML syntax uses the $ (dollar sign) for de-referencing a variable. To display the character, $$ must be specified, otherwise most WML browsers return an error. If an xml file containing a $ in a node is transformed via XSL (using the xsl:value-of statement) to produce WML, the $ is output as a $. Other characters such as &, <, " are output in the encoded form. Does a special encoding scheme exist to force the output of a $ in encoded format? Does some other mechanism exist to allow character transformations to be customized within an xsl:value-of operation? Pre-processing the xml file is an issue as the vast majority of xml inputs do not contain a $. Post processing the transformed output is also an issue as the output does contain WML variable references using the $.
<block> <xsl:call-template name="dollar"> <xsl:with-param name="text" select="ELEMENT_TO_FIX" /> </xsl:call-template> </block>
<xsl:template match="text()" name="dollar"> <xsl:param name="text" select="."/> <xsl:choose> <xsl:when test="contains($text,'$')"> <xsl:value-of select="substring-before($text,'$')"/> <xsl:text>$$</xsl:text> <xsl:call-template name="dollar"> <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>
Regards, Stephen Zisk
---------- Stephen Zisk MediaBridge Technologies email: szisk@xxxxxxxxxxxxxxx 100 Nagog Park tel: 978-795-7040 Acton, MA 01720 USA fax: 978-795-7100 http://www.mediabridge.net
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
encoding $ character for wml output, Dweed | Thread | passing through special characters, Steve Morrison |
Re: Checking node position, Gary L Peskin | Date | RE: XSL in Perl, Chris Bayes |
Month |