View Single Post
  #1 (permalink)  
Old February 10th, 2006, 04:48 PM
briforge briforge is offline
Registered User
 
Join Date: Sep 2005
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to use call-template result in a test?

I'd like to call a template and then use the result in a test. I'm trying to make a change from this:

Code:
<xsl:if test="boolean(/Amt)">
  <xsl:element name="DamageAmt">            
    <xsl:call-template name="convertCurrency">
      <xsl:with-param name="currency" select="/Amt">
        </xsl:with-param>
      </xsl:call-template>
    </xsl:element>
</xsl:if>
The convertCurrency template basically just strips out non-numeric characters. I'd like to use the result of that in the 'if test' clause so that if there is no non-numeric data left, the <DamageAmt> element is not output at all. As it stands now, it can create an empty <DamageAmt> element, which errors out because the xsd states that if the element is there, it can't be empty.

I inherited maintenance of this and my knowledge of XSLT is very patchy. I can kind of follow what it's doing and make minor changes but can't figure out how to do something new and different like this.

Thanks
Reply With Quote