Announcement

Collapse
No announcement yet.

Tender Stylesheets - Multiple xsl:when conditions

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • 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!!!

  • #2
    Re: Tender Stylesheets - Multiple xsl:when conditions

    Hi,

    I don't think multiple <xsl:when>s with one <xsltherwise> will work. I haven't used or seen multiple when conditions with single otherwise in GC3.

    Have you tried something like this?

    if shipment refnum value = ABC or shipment refnum value = DEF or shipment refnum value = GHI

    then use template A

    otherwise
    use template B


    I have implemented my conditions this way manytimes and it works fine for me.

    Also, please check if your xpaths (eg. /notify/Blob/xml/TenderOffer/Shipment/ShipUnit/ShipUnitContent/ItemQuantity/ItemTag2) are fetching the correct values.

    Let me know if you need more info.


    Regards,
    Satya

    Comment


    • #3
      Re: Tender Stylesheets - Multiple xsl:when conditions

      Yes you are right my xpath was wrong... I'm still waiting to restart to test though.

      Satya, would you mind elaborating on how "if shipment refnum value = ABC or shipment refnum value = DEF or shipment refnum value = GHI" would look in an XSL file? I'm an XSL novice so I appreciate the help!

      Comment


      • #4
        Re: Tender Stylesheets - Multiple xsl:when conditions

        Ok nevermind, I got it working today. It appears that multiple <xsl:when>s with one otherwise, does work in OTM xsl files. Thanks for the help!

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎