Reputation: 631
Let's say I have an XML like below.
<CUSTOMER_ORDER>
<MSG_DATE><?MSG_DATE>
<DOCUMENT_TYPE></DOCUMENT_TYPE>
</CUSTOMER_ORDER>
let's imagine that I have a XSLT as well.
I want to apply this transformer only if DOCUMENT_TYPE = 'S'. Is there any way I can achieve this in the XSLT??
Upvotes: 0
Views: 116
Reputation: 1086
Check this:-
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="//DOCUMENT_TYPE='S'">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Upvotes: 1