Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSLT - String manipulation 1

Status
Not open for further replies.

ddrillich

Technical User
Jun 11, 2003
546
US
Good Day,

The variable ref contains a value that might or might not contain a period and the following code fails on the last line.

Code:
<xsl:choose>

 <xsl:when test="contains($ref,'.')">
      <xsl:variable name="refCut6" select="substring-before($ref, '.')"  />
 </xsl:when>

 <xsl:otherwise>
      <xsl:variable name="refCut6" select="$ref"  />
 </xsl:otherwise>

</xsl:choose>

<xxx><xsl:value-of select="$refCut6"/></xxx>


Any ideas?

Regards,
Dan



 
This makes $refCut6 in-scope.
[tt]
<xsl:variable name="refCut6">
<xsl:choose>
<xsl:when test="contains($ref,'.')">
<xsl:value-of select="substring-before($ref, '.')" />
</xsl:when>
<xsl:eek:therwise>
<xsl:value-of select="$ref" />
</xsl:eek:therwise>
</xsl:choose>
</xsl:variable>
<xxx><xsl:value-of select="$refCut6"/></xxx>
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top