View Single Post
  #1 (permalink)  
Old October 3rd, 2007, 13:40
tangfj tangfj is offline
Member
 
Join Date: Mar 2007
Location: Chicago
Posts: 30
Groans: 0
Groaned at 0 Times in 0 Posts
Thanks: 2
Thanked 1 Time in 1 Post
Rep Power: 0
tangfj is on a distinguished road
Tender Stylesheets - Multiple xsl:when conditions

Hello everyone,

I have a situation here where I would like to send a different message when a particular condition is met.

For example:

if a shipment refnum value = ABC
then use template A

or if a shipment refnum value = DEF
then use template A

or if a shipment refnum value = GHI
then use template A

otherwise use template B

So far I have been able to get it to work with one condition...

if shipment ship unit item tag = ABC
then use template A

otherwise use template B

I have not been able to get it working with multiple conditions, however. In my code for multiple conditions I'm checking on shipment ship unit item tags and shipment refnum values.


Below is an excerpt from my XSL code. Anyone know why this isn't working for me? It seems to be going straight to the "otherwise" statement when I know that it should be using one of the "when" statements.

<xsl:choose>
<xsl:when test="/notify/Blob/xml/TenderOffer/Shipment/ShipUnit/ShipUnitContent/ItemQuantity/ItemTag2='ABC'">
<xsl:call-template name="tenderHeader">
<xsl:with-param name="mes" select="string('message.TenderResponseNotNeeded')"/>
<xsl:with-param name="incURL" select="$includeURL"/>
<xsl:with-param name="incReplyBy" select="string('N')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="/notify/Blob/xml/TenderOffer/Shipment/ShipmentHeader/ShipmenRefnumQualifierGid/ShipmentRefnumValue='ABC'">
<xsl:call-template name="tenderHeader">
<xsl:with-param name="mes" select="string('message.TenderResponseNotNeeded')"/>
<xsl:with-param name="incURL" select="$includeURL"/>
<xsl:with-param name="incReplyBy" select="string('N')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="/notify/Blob/xml/TenderOffer/Shipment/ShipmentHeader/ShipmenRefnumQualifierGid/ShipmentRefnumValue='DEF'">
<xsl:call-template name="tenderHeader">
<xsl:with-param name="mes" select="string('message.TenderResponseNotNeeded')"/>
<xsl:with-param name="incURL" select="$includeURL"/>
<xsl:with-param name="incReplyBy" select="string('N')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="/notify/Blob/xml/TenderOffer/Shipment/ShipmentHeader/ShipmenRefnumQualifierGid/ShipmentRefnumValue='GHI'">
<xsl:call-template name="tenderHeader">
<xsl:with-param name="mes" select="string('message.TenderResponseNotNeeded')"/>
<xsl:with-param name="incURL" select="$includeURL"/>
<xsl:with-param name="incReplyBy" select="string('N')"/>
</xsl:call-template>
</xsl:when>
<xsltherwise>
<xsl:call-template name="tenderHeader">
<xsl:with-param name="mes" select="$message"/>
<xsl:with-param name="incURL" select="$includeURL"/>
<xsl:with-param name="incReplyBy" select="$includeReplyBy"/>
</xsl:call-template>
</xsltherwise>


Thanks in advance for the help!!!
Reply With Quote