【发布时间】:2019-08-13 01:03:38
【问题描述】:
我想看看940 X12的N3和N4线在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*Boss计数器显示~ N3*18 沙漏步道~ N4*西区*CN*06881~ N1*ST*山姆马龙*91*BD01~ N3*17沙漏步道~ N4*西港*CT*06880*US~ N9*23*Boss计数器显示~ G62*10*20190311~ G62*02*20190312~ W66*CC*M***UPE~
谢谢!
【问题讨论】:
-
请更新您的帖子以解释您的具体问题是什么:您说您要完成什么,但您没有说您遇到了什么麻烦。还请包括您的输入 XML 示例和所需的输出 XML。理想情况下,如果您提供minimal, complete, and verifiable example,我们将能够为您提供最好的帮助。此外,示例 XSLT 中的 XPath 表达式与任何东西都没有明显的相关性......