Subject: Re: [xsl] Re: Returning a value from a template From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 10 Nov 2010 13:04:35 -0500 |
Yes ... don't use the flag. Something along the lines of:
<xsl:template name="getOrderSource">
<xsl:for-each select="/ns0:Transaction-850/ns0:Loop-N1">
<xsl:choose>
<xsl:when test='ns0:Segment-N1/ns0:Element-66 = "21"'>NAEDI</xsl:when>
<xsl:otherwise>NAEDIBrokerage</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
...
Thanks Ken. The problem with the above approach is that if there are 3 Loop-N1's
then the output would be:
<corecom:ID>NAEDIBrokerageNAEDIBrokerageNAEDIBrokerage</corecom:ID>
Thats why I was trying to set a flag inside the loop and then return a Single value.
<xsl:template name="getOrderSource"> <xsl:choose> <xsl:when test='/ns0:Transaction-850/ns0:Loop-N1/ ns0:Segment-N1/ns0:Element-66 = "21"'>NAEDI</xsl:when> <xsl:otherwise>NAEDIBrokerage</xsl:otherwise> </xsl:choose> </xsl:template>
-- Contact us for world-wide XML consulting & instructor-led training Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Returning a value from a , Narayan | Thread | [xsl] removing crlf character with , ram |
[xsl] Re: Returning a value from a , Narayan | Date | Re: [xsl] How to remove unnecessary, Wolfgang Laun |
Month |