0
<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>
我想組和計數missing_data @ missing_in和line_not_found @ IDXSLT集團通過+計數基於幾個標籤水平
例如,在這種情況下: 阿基米德 - PDT:1 阿基米德 - ADR:1 Cassiope - PDT:2 Cassiope - ADR:4
我不得不承認我是XSLT的完整初學者。 我試圖從Xslt distinct select/Group by得到啓發,但問題並不完全相同,因爲我的密鑰是複合的,但是來自多個XML標籤。
我的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強制在這個項目上
在此先感謝