|
next
|
Subject: Escape a character in the string Author: Tony Lavinio Date: 20 Jan 2009 10:58 AM
|
First, instead of this:
<xsl:variable name="string"><xsl:value-of select="value/item[@name='FieldName']"/></xsl:variable>
get into the habit of writing this, which doesn't require creating
a small tree, but instead just assigns the atomic value to the variable:
<xsl:variable name="string" select="value/item[@name='FieldName']"/>
Next, you never told the code what to do if $string does not contain
an underscore. Try this:
<xsl:choose>
<xsl:when test="contains($string, '_')">
<xsl:value-of select="concat(substring-before($string, '_'), ' ', substring-after($string, '_'))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
<xsl:choose>
In the future, general XSLT questions are best handled on the
general-purpose XSL-LIST run by Mulberry Technologies
|
|
|