none
XSLT of N1 looping segment not getting expected result... RRS feed

  • Question

  • Hi ,

          I need to Map N101 and N102 to ShipTo once and same for BillTo to once based on value of N101.

    My Input file looks like :

    ISA>00>          >00>          >01>006906614GE    >12>2018040800     >130722>0313>U>00401>000000005>1>P>:~
    GS>PO>006906614GE>2018040800>20130722>0313>5>X>004010~
    ST>850>018669036~
    BEG>00>NE>018669036>>20130722~
    DTM>002>20130805~
    N1>BT>AmerisourceBergen~
    N4>Thorofare>NJ>08086~
    N1>ST>ABC  DC ROANOKE>11>RA0316958~
    N3>501 PATRIOT PARKWAY~
    N4>ROANOKE>TX>76262-6336~
    N1>SU>CEDARDALE DISTRIBUTORS LLC>1>RC0282498~

    If N101 is 'BT' then  I need to Map to BillTo  and N101 is 'ST' then  I need to Map to ShipTo and N101 is 'BS' then  I need to Map to BillTo and ShipTo.

    For That I developed One xslt call-template which looks like :

    <xsl:template name="AddressTemplate"   xmlns="http://schemas.microsoft.com/BizTalk/EDI/X12/2006/Sam810">
    <xsl:param name="N101"/>
    <xsl:param name="N102"/>
    <xsl:choose>
    <xsl:when test="$N101=ST" >
    <xsl:element name ="ShipTo">
    <xsl:value-of select="$N102"/>
    </xsl:element>
    </xsl:when>
    <xsl:when test="$N101=BT" >
    <xsl:element name ="BillTo">
    <xsl:value-of select="$N102"/>
    </xsl:element>
    </xsl:when>
    <!--  If N101 has value of BS  -->
    <xsl:otherwise>
    <xsl:element name ="BillTo">
    <xsl:value-of select="$N102"/>
    </xsl:element>
    <xsl:element name ="ShipTo">
    <xsl:value-of select="$N102"/>
    </xsl:element>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>

    Then end result of the script is  same for BillTo and Shipto.


    Chittidi


    • Edited by Chittidi Friday, August 2, 2013 2:54 PM aa
    Friday, August 2, 2013 2:42 PM

Answers