Reputation: 639
My goal is to use this XSLT stylesheet to remove the entire LoanSecondaryStatus node when the StatusDate is 1900-01-01T00:00:00, but otherwise keep the node when it is any other date.
I have the following XML:
<Loans>
<Loan>
<LoanSecondaryStatus>
<StatusName>Application Started</StatusName>
<StatusDate>1900-01-01T00:00:00</StatusDate>
</LoanSecondaryStatus>
<LoanSecondaryStatus>
<StatusName>Application Finished</StatusName>
<StatusDate>2016-03-02T00:00:00</StatusDate>
</LoanSecondaryStatus>
</Loan>
</Loans>
And here is the XSLT i'm using to try and remove the LoanSecondaryStatus node:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" />
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/LoanSecondaryStatus[not(StatusDate='1900-01-01T00:00:00')]"/>
</xsl:stylesheet>
Upvotes: 0
Views: 1053
Reputation: 117140
remove the entire LoanSecondaryStatus node when the StatusDate is 1900-01-01T00:00:00
I believe your 2nd template needs to be:
<xsl:template match="LoanSecondaryStatus[StatusDate='1900-01-01T00:00:00']"/>
Upvotes: 1