<result>
<account id="123456">
<missing_data missing_in="Archimede"/>
<line_not_found db_table="PRODUCT" id="PDT">
</line_not_found>
<line_not_found db_table="ADRESS" id="ADR">
</line_not_found>
</missing_data>
<missing_data missing_in="Cassiope">
<line_not_found db_table="PRODUCT" id="PDT">
</line_not_found>
<line_not_found db_table="PRODUCT" id="PDT">
</line_not_found>
<line_not_found db_table="ADRESS" id="ADR">
</line_not_found>
<line_not_found db_table="ADRESS" id="ADR">
</line_not_found>
<line_not_found db_table="ADRESS" id="ADR">
</line_not_found>
<line_not_found db_table="ADRESS" id="ADR">
</line_not_found>
</missing_data>
</account>
</result>
I would like to group and count the missing_data@missing_in and line_not_found@id
For example, in this case : Archimede - PDT : 1 Archimede - ADR : 1 Cassiope - PDT : 2 Cassiope - ADR : 4
I have to admit that I am a complete beginner to XSLT. I tried to inspire from Xslt distinct select / Group by but the problem is not quite the same since my key is composite but from several XML tags.
My XSL :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:key name="missing_data_key" match="line_not_found" use="concat(../@missing_in, ',', @id)"/>
<xsl:template match="/">
<xsl:for-each select="result/account">
<xsl:value-of select="@id" />
<xsl:for-each select="missing_data/line_not_found[
count(
.|key('missing_data_key', @id)[1]
) = 1
]
">
<ul>
<xsl:value-of select="@id"/>
( absent dans
<xsl:value-of select="../@missing_in"/>
)
<xsl:value-of select="' - '"/>
<xsl:value-of select="
count(
key('missing_data_key', ../@missing_in)[
count(
key('missing_data_key', concat(../@missing_in,',',@id))[1]
) = 1
]
)
"/>
</ul>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
XSLT 1 mandatory on this project
Thanks in advance