I'm trying to remove the node which contains (Descriptor=ID1
) but it returns below error.
XML
<?xml version='1.0' encoding='UTF-8'?>
<Data>
<Entry>
<Line>1</Line>
<Reference Descriptor="ID1">
<ID type="ID">gbgfdbnfg</ID>
</Reference>
<Reference Descriptor="ID2">
<ID type="ID">tshbtdsg</ID>
</Reference>
<Reference Descriptor="ID3">
<ID type="ID">rhbdgb</ID>
</Reference>
</Entry>
</Data>
XSLT
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*[contains(Reference/@Descriptor,'ID1')]">
<!-- Do nothing -->
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Error:
A sequence of more than one item is not allowed as the first argument of
fn:contains() ("ID1", "ID2")
Expected Output:
<?xml version='1.0' encoding='UTF-8'?>
<Data>
<Entry>
<Line>1</Line>
<Reference Descriptor="ID2">
<ID type="ID">tshbtdsg</ID>
</Reference>
<Reference Descriptor="ID3">
<ID type="ID">rhbdgb</ID>
</Reference>
</Entry>
</Data>