My XML is following:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Rowsets CachedTime="" DateCreated="2014-08-08T05:23:47" EndDate="2014-08-08T05:23:45" StartDate="2014-08-08T04:23:45" Version="14.0.0 Build(802)">
<Rowset>
<Row>
<Name>MAKTX</Name>
<Value>Ethanol</Value>
<Min>4</Min>
<Max>4</Max>
</Row>
<Row>
<Name>SEQNR</Name>
<Value>T10</Value>
<Min>5</Min>
<Max>15</Max>
</Row>
<Row>
<Name>QNT</Name>
<Value>10</Value>
<Min>0</Min>
<Max>10000000000000</Max>
</Row>
</Rowset>
<Rowset>
<Row>
<Name>MAKTX</Name>
<Value>CO2</Value>
<Min>4</Min>
<Max>4</Max>
</Row>
<Row>
<Name>SEQNR</Name>
<Value>T8</Value>
<Min>5</Min>
<Max>15</Max>
</Row>
<Row>
<Name>QNT</Name>
<Value/>
<Min>0</Min>
<Max>10000000000000</Max>
</Row>
</Rowset>
<Rowset>
<Row>
<Name>MAKTX</Name>
<Value/>
<Min>4</Min>
<Max>4</Max>
</Row>
<Row>
<Name>SEQNR</Name>
<Value>-- Select One --</Value>
<Min>5</Min>
<Max>15</Max>
</Row>
<Row>
<Name>QNT</Name>
<Value/>
<Min>0</Min>
<Max>10000000000000</Max>
</Row>
</Rowset>
</Rowsets>
I want a resultant XML which contains only those <Rowset> where [Name='QNT']/Value = '' and [Name = 'MAKTX']/Value = ''.
My XSLT looks like following:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java" version="1.0">
<xsl:output media-type="text/xml" method="xml"/>
<!-- Filters refdoc based on condition and data -->
<xsl:template match="/Rowsets">
<Rowsets>
<xsl:for-each select="/Rowsets/Rowset">
<xsl:choose>
<xsl:when test="Rowset[Row[Name='QNT']/Value = '' and Row[Name = 'MAKTX']/Value = '']">
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</Rowsets>
</xsl:template>
</xsl:stylesheet>
But it is giving me entire XML as output and not removing the last <Rowset>. I tried variosa permutations and combinations but no success.
What am I doing wrong here?