Я хотел посмотреть, есть ли где-нибудь, чтобы получить линии N3 и N4 940 X12, когда строка N1 является ST (адрес доставки)
Вот мой xslt
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="text" indent="yes"/>
<xsl:template match="Interchange">
<xsl:apply-templates select="FunctionGroup/Transaction/Loop[@LoopId='0300']/Loop[@LoopId='0310']"/>
</xsl:template>
<xsl:template match="Loop[@LoopId='0310']" >
<xsl:variable name="order" select="../../."/>
<xsl:variable name="customer" select="../../Loop[@LoopId='0100']"/>
<xsl:variable name="line" select="../."/>
<xsl:variable name="SKU" select="."/>
<xsl:value-of select="$order/W05/W0502"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$order/W05/W0503"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$order/W05/W0504"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$customer/N1[N101='ST']/N104"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$customer/N1[N101='ST']/N102"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$customer/N3/N301"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$customer/N4/N401"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$customer/N4/N402"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$customer/N4/N403"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$customer/N4/N404"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$order/G62[G6201='10']/G6202"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$order/G62[G6201='02']/G6202"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$order/W66/W6605"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$line/LX/LX01"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$SKU/W01/W0105"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$SKU/W01/W0101"/>
<xsl:value-of select="','"/>
<xsl:value-of select="$SKU/W01/W0107"/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
образец X12:
ST * 940 * 6470101 ~
W05 * N * 14071 * дисплей ~
N1 * BT * Дисплей счетчика боссов ~
N3 * 18 Sandhopper Trail ~
N4 * Westpart * CN * 06881 ~
N1 * ST * Сэм Мэлоун * 91 * BD01 ~
N3 * 17 Sandhopper Trail ~
N4 * Westport * CT * 06880 * США ~
N9 * 23 * Дисплей счетчика боссов ~
G62 * 10 * 20190311 ~
G62 * 02 * 20190312 ~
W66 * CC * M *** ВНО ~
Спасибо!