I want to keep element in XML and remove others, in XSLT 1.0, based on an attribute value that mus match a parent attribute
I want to keep only DONNEES Elements where attribute Journee matches the parent attribute Date. It can be any date I cannot put something like ='2015-09-17T06:00:00'.
Here is the XML example
<?xml version="1.0"?>
<Root>
<JOURNEE Date="2015-09-17T06:00:00">
<ID>
<DONNEES Journee="2015-09-17T06:00:00"/>
<DONNEES Journee="2015-09-18T06:00:00"/>
<DONNEES Journee="2015-09-19T06:00:00"/>
</ID>
</JOURNEE>
<JOURNEE Date="2015-09-18T06:00:00">
<ID>
<DONNEES Journee="2015-09-17T06:00:00"/>
<DONNEES Journee="2015-09-18T06:00:00"/>
<DONNEES Journee="2015-09-19T06:00:00"/>
</ID>
</JOURNEE>
<JOURNEE Date="2015-09-19T06:00:00">
<ID>
<DONNEES Journee="2015-09-17T06:00:00"/>
<DONNEES Journee="2015-09-18T06:00:00"/>
<DONNEES Journee="2015-09-19T06:00:00"/>
</ID>
</JOURNEE>
</Root>
Here is the output I want
<Root>
<JOURNEE Date="2015-09-17T06:00:00">
<ID>
<DONNEES Journee="2015-09-17T06:00:00"/>
</ID>
</JOURNEE>
<JOURNEE Date="2015-09-18T06:00:00">
<ID>
<DONNEES Journee="2015-09-18T06:00:00"/>
</ID>
</JOURNEE>
<JOURNEE Date="2015-09-19T06:00:00">
<ID>
<DONNEES Journee="2015-09-19T06:00:00"/>
</ID>
</JOURNEE>
</Root>
Here is the XSLT I have for now that doesn't work it delete all datas
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/*/*/*DONNEES[(@Journee != /*/JOURNEE/@Date)]" />
I tried this and it works but I cannot have data like this
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/*/*/*DONNEES[(@Journee != '2015-09-17T06:00:00')]" />
Thank you :)