xsl-list
[Top] [All Lists]

Re: [NEWBIE] XSL String Manipulation Question.

2003-02-07 02:46:18

Hi Justin,

I have a few fields I'm trying format, into the same variable, and it's
not
working.

If you define a variable, you can control the value to be assigned with
conditions.

 <xsl:variable name="strUnitBlock" select="$strUnitNumber"/>

 <xsl:if test="$strUnitBlock != ''">
   <xsl:if test="$strUnitSeperator != ''">
       <xsl:variable name="strUnitBlock" select="concat($strUnitBlock,
$strUnitSeperator)"/>
   </xsl:if>
 </xsl:if>

  <xsl:variable name="strUnitBlock" select="concat($strUnitBlock,
$strStreetNumber)"/>

Try something like this (untested):

<xsl:variable name="strUnitBlock">

  <xsl:choose>
    <xsl: when test="($strUnitBlock != '') and ($strUnitSeperator != '')">
      <xsl:value-of select="concat($strUnitBlock, $strUnitSeperator)"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$strUnitNumber"/>
    </xsl:otherwise>
  </xsl:choose>

</xsl:variable>

HTH,
Julia

----------------------------------------------------

Julia Fichter
Research & Development

Propack Data GmbH
A Rockwell Automation Business



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>