Hi,
benötige eine Prüfung ob unter "Item" der Unterpunkt "ItemDeliveryInformation" existiert.
Wenn nein, soll dieser mit weiteren Unterpunkten erstellt werden.
LineNumDeliveryNote = 0
PackingSlipId = HeaderInformation/InvoiceNumber
DeliveryDate = HeaderInformation/InvoiceDate
DeliveredQuantity = von der entsprechenden Item die TotalQuantity
XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<SALESINVOICE>
<HeaderInformation>
<InvoiceDate>20200615</InvoiceDate>
<InvoiceNumber>201023815</InvoiceNumber>
</HeaderInformation>
<LineInformation>
<Item>
<LineNum>1</LineNum>
<TotalQuantity>920.00</TotalQuantity>
</Item>
</LineInformation>
<LineInformation>
<Item>
<LineNum>2</LineNum>
<TotalQuantity>23.00</TotalQuantity>
<ItemDeliveryInformation>
<LineNumDeliveryNote>0</LineNumDeliveryNote>
<DeliveryDate>20200615</DeliveryDate>
<DeliveredQuantity>23.00</DeliveredQuantity>
</ItemDeliveryInformation>
</Item>
</LineInformation>
</SALESINVOICE>
XSLT:
<xsl:template match="Item">
<xsl:copy-of select="."/>
<xsl:if test="not(ItemDeliveryInformation)">
<ItemDeliveryInformation>
<LineNumDeliveryNote>0</LineNumDeliveryNote>
<PackingSlipId><xsl:value-of select="/SALESINVOICE/HeaderInformation/InvoiceNumber"/></PackingSlipId>
<DeliveryDate><xsl:value-of select="/SALESINVOICE/HeaderInformation/InvoiceDate"/></DeliveryDate>
<DeliveredQuantity><xsl:value-of select="hier soll die TotalQuantity der richtigen Item stehen, unterscheidet sich durch die LineNum"/></DeliveredQuantity>
</ItemDeliveryInformation>
</xsl:if>
</xsl:template>
Korrekt:
<?xml version="1.0" encoding="ISO-8859-1"?>
<SALESINVOICE>
<HeaderInformation>
<InvoiceDate>20200615</InvoiceDate>
<InvoiceNumber>201023815</InvoiceNumber>
</HeaderInformation>
<LineInformation>
<Item>
<LineNum>1</LineNum>
<TotalQuantity>920.00</TotalQuantity>
<ItemDeliveryInformation>
<LineNumDeliveryNote>0</LineNumDeliveryNote>
<PackingSlipId>LS264694</PackingSlipId>
<DeliveryDate>20200615</DeliveryDate>
<DeliveredQuantity>920.00</DeliveredQuantity>
</ItemDeliveryInformation>
</Item>
</LineInformation>
<LineInformation>
<Item>
<LineNum>2</LineNum>
<TotalQuantity>23.00</TotalQuantity>
<ItemDeliveryInformation>
<LineNumDeliveryNote>1</LineNumDeliveryNote>
<PackingSlipId>LS264694</PackingSlipId>
<DeliveryDate>20200615</DeliveryDate>
<DeliveredQuantity>23.00</DeliveredQuantity>
</ItemDeliveryInformation>
</Item>
</LineInformation>
</SALESINVOICE>