Hallo juls_pro_37,
Hilft dir das u.s. erweiterte XML weiter? xmls-version 1.0. -> kann ich da das von dir vorgeschlagene xslt 2.0 verwenden?
Mir hilft es zumindest zum Erezugen der Ausgabe:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" standalone="yes" indent="yes"/>
<!-- Identity-Template für die nicht explizit benannten Elemente -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="HeaderInformation">
<HeaderInformation>
<xsl:copy-of select="HeaderText[1]/preceding-sibling::*"/>
<xsl:for-each-group select="HeaderText" group-by="Qualifier">
<xsl:for-each select="current-group()">
<xsl:if test="position() = 1">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:for-each-group>
<xsl:apply-templates select="LineItem"/>
</HeaderInformation>
</xsl:template>
<xsl:template match="LineItem">
<LineItem>
<Lines>
<xsl:copy-of select="Lines/LineText[1]/preceding-sibling::*"/>
<xsl:for-each-group select="Lines/LineText" group-by="Qualifier">
<xsl:for-each select="current-group()">
<xsl:if test="position() = 1">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:for-each-group>
</Lines>
</LineItem>
</xsl:template>
</xsl:stylesheet>
XML-Ergebnis:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<SALESINVOICE>
<Interchange>
<Recipient/>
<Sender/>
<HeaderInformation>
<OrigInvoiceNumber>4´1</OrigInvoiceNumber>
<InvoiceType>INVOIC</InvoiceType>
<HeaderText>
<Qualifier>AAI</Qualifier>
<Text>AAI10854</Text>
</HeaderText>
<HeaderText>
<Qualifier>DEL</Qualifier>
<Text>DEL0854</Text>
</HeaderText>
<LineItem>
<Lines>
<OrderLineNum>1</OrderLineNum>
<GTINNumber>1234567891234</GTINNumber>
<GTINDescription>Testartikel</GTINDescription>
<LineText>
<Qualifier>AAA</Qualifier>
<Text>AAA1-0927</Text>
</LineText>
<LineText>
<Qualifier>LIN</Qualifier>
<Text>LIN1-0927</Text>
</LineText>
</Lines>
</LineItem>
</HeaderInformation>
</Interchange>
</SALESINVOICE>
Grüße,
Thomas