none
810 N1 element Mapping RRS feed

  • Question

  • I need to be able to selectively map elements from a particular N1-N5 block, based on the value of the N101 element to a flat file for use as the Shipto and billto information.

     

    What's the easiest combination of functoids and black magic to make this happen?

     

    Friday, June 29, 2007 1:00 AM

Answers

  • As an example there is a Xslt Inline Script functoid working with N1-N5 segments.
    It has no input links and one Output link to "Shipper" record.
     
    <Shipper>
     <xsl:for-each select="s0:N1Loop1[s0:N1/N101/text() = 'SH'][1]">        
      <Name>
       <xsl:value-of select="s0:N1/N102/text()" />
      </Name>
      <Address>
       <Line1>
        <xsl:value-of select="s0:N3[1]/N301/text()" />
       </Line1>
       <Line2>
        <xsl:value-of select="string(userCSharp:AddressConcat(string(N3[1]/N302/text()), string(s0:N3[2]/N301/text()), string(s0:N3[2]/N302/text())))" />
       </Line2>
       <City>
        <xsl:value-of select="s0:N4[1]/N401/text()" />
       </City>
       <ProvinceCode>
        <xsl:value-of select="s0:N4[1]/N402/text()" />
       </ProvinceCode>
       <PostalCode>
        <xsl:value-of select="s0:N4[1]/N403/text()" />
       </PostalCode>
       <CountryCode>
        <xsl:value-of select="s0:N4[1]/N404/text()" />
       </CountryCode>
      </Address>
     </xsl:for-each>
    </Shipper>
     
     
    Regards,
     
    Leonid Ganeline
     
    Friday, June 29, 2007 4:35 PM

All replies

  • As an example there is a Xslt Inline Script functoid working with N1-N5 segments.
    It has no input links and one Output link to "Shipper" record.
     
    <Shipper>
     <xsl:for-each select="s0:N1Loop1[s0:N1/N101/text() = 'SH'][1]">        
      <Name>
       <xsl:value-of select="s0:N1/N102/text()" />
      </Name>
      <Address>
       <Line1>
        <xsl:value-of select="s0:N3[1]/N301/text()" />
       </Line1>
       <Line2>
        <xsl:value-of select="string(userCSharp:AddressConcat(string(N3[1]/N302/text()), string(s0:N3[2]/N301/text()), string(s0:N3[2]/N302/text())))" />
       </Line2>
       <City>
        <xsl:value-of select="s0:N4[1]/N401/text()" />
       </City>
       <ProvinceCode>
        <xsl:value-of select="s0:N4[1]/N402/text()" />
       </ProvinceCode>
       <PostalCode>
        <xsl:value-of select="s0:N4[1]/N403/text()" />
       </PostalCode>
       <CountryCode>
        <xsl:value-of select="s0:N4[1]/N404/text()" />
       </CountryCode>
      </Address>
     </xsl:for-each>
    </Shipper>
     
     
    Regards,
     
    Leonid Ganeline
     
    Friday, June 29, 2007 4:35 PM
  • Leonid,

     

    I'm still trying to figure out the way of using xpath with EDIFACT. It would be helpful for me to understand your example even it's X12. I assume your example refers to the file "X12_00401_810.xsd". Can you tell me what does "s0" indicate?

    <xsl:for-each select="s0:N1Loop1[s0:N1/N101/text() = 'SH'][1]"> 

     

     

    Saturday, May 31, 2008 8:14 PM