Delivery document xml contains two <SourceDocument>
tags:
<SourceDocument type="order">
以及
<SourceDocument type="desadv">
我试图从<代码><、SourceDocument类型=“order”>、上提取编号。
<xsl:element name="tellimus">
<xsl:value-of select="../../RefInfo/SourceDocument/SourceDocumentNum"/>
</xsl:element>
但是,由此产生的xml文档中的<、tellimus>、
要素中提取订单编号?
XML:
<?xml version="1.0" encoding="UTF-8"?>
<E-Document>
<Header>
<DateIssued>2008-04-07</DateIssued>
<SenderID>100</SenderID>
<ReceiverID>-</ReceiverID>
</Header>
<Document>
<DocumentType>recadv</DocumentType>
<DocumentParties>
<DeliveryParty context="self">
<PartyCode>100</PartyCode>
<Name>Selveri DC</Name>
</DeliveryParty>
<OrderParty context="self">
<PartyCode>134</PartyCode>
<Name>Torupilli Selver</Name>
</OrderParty>
<SellerParty context="partner">
<PartyCode>-</PartyCode>
<Name>Tarnija</Name>
</SellerParty>
</DocumentParties>
<DocumentInfo>
<DocumentNum>200015496</DocumentNum>
<DateInfo>
<DeliveryDateActual>2008-04-07</DeliveryDateActual>
<ProcessingDate>2010-05-11</ProcessingDate>
</DateInfo>
<RefInfo>
<SourceDocument type="order">
<SourceDocumentNum>OR51500044007</SourceDocumentNum>
</SourceDocument>
<SourceDocument type="desadv">
<SourceDocumentNum>DA51500044007</SourceDocumentNum>
</SourceDocument>
</RefInfo>
</DocumentInfo>
<DocumentItem>
<ItemEntry>
<LineItemNum>1</LineItemNum>
<SellerItemCode>11001</SellerItemCode>
<GTIN>4740125110012</GTIN>
<ItemDescription>Piim 2.5% 1L kile</ItemDescription>
<ItemUnitRecord>
<ItemUnit>tk</ItemUnit>
</ItemUnitRecord>
<BaseUnit>tk</BaseUnit>
<AmountOrdered>40.000</AmountOrdered>
<AmountActual>40.000</AmountActual>
<ItemReserve>
<LotNum>04.03.2011</LotNum>
<BestBeforeMin>2011-03-04</BestBeforeMin>
<SerialNum/>
<ItemReserveUnit>
<ItemUnit>tk</ItemUnit>
<AmountActual>40.000</AmountActual>
</ItemReserveUnit>
</ItemReserve>
</ItemEntry>
</DocumentItem>
</Document>
</E-Document>
XSL:
<?xml version="1.0" encoding="ISO-8859-1" st以及alone="no" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" st以及alone="yes"/>
<xsl:template match="/">
<xsl:element name="VFPData">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<!-- this will denormalize XML data -->
<xsl:template match="/E-Document/Document/DocumentItem/*">
<xsl:element name="Document-Order">
<!-- TODO: how to extract order number -->
<xsl:element name="tellimus">
<xsl:value-of select="../../RefInfo/SourceDocument/SourceDocumentNum"/>
</xsl:element>
</xsl:element>
</xsl:template>
<!-- to ommit nodes data -->
<xsl:template match="text()">
</xsl:template>
<!-- to work over every node -->
<xsl:template match="*">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>