Hallo juls_pro_37,
-> Nur leider war ich erfolglos bei der Umsetzung der Muenchian Grouping und eine Umstellung auf XSLT 2.0 ist noch fraglich…
Ok, habe das nochmal mit XSLT 1.0 umgesetzt:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" standalone="yes" indent="yes"/>
<xsl:key name="header_text" match="HeaderText" use="Qualifier"/>
<xsl:key name="line_text" match="LineText" use="Qualifier"/>
<!-- 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 select="HeaderText[generate-id() =
generate-id(key('header_text', Qualifier)[1])]">
<xsl:variable name="akt_key" select="Qualifier"/>
<xsl:variable name="akt_group" select="key('header_text', $akt_key)"/>
<xsl:for-each select="$akt_group">
<xsl:if test="position() = 1">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
<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 select="Lines/LineText[generate-id() =
generate-id(key('line_text', Qualifier)[1])]">
<xsl:variable name="akt_key" select="Qualifier"/>
<xsl:variable name="akt_group" select="key('line_text', $akt_key)"/>
<xsl:for-each select="$akt_group">
<xsl:if test="position() = 1">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</Lines>
</LineItem>
</xsl:template>
</xsl:stylesheet>
Und es gilt natürlich wieder … 😎
Grüße,
Thomas