I want to check occurrence of certain text. Below is my xslt:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:output method="xml" version="1.0"
encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<!-- Notify PANTONE - If YES -->
<xsl:if test="contains(xmlreport/PageInfo/PageAttribute/PageColor,'PANTONE')">
<PantonePage><note>Yes</note></PantonePage>
</xsl:if>
<!-- Notify PANTONE - If NO -->
<xsl:if test="not(contains(xmlreport/PageInfo/PageAttribute/PageColor,'PANTONE'))">
<PantonePage><note>No</note></PantonePage>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
My desire output should be either:
<pantone>Yes</pantone>
or
<pantone>No</pantone>
In the original XML, PANTONE might be PANTONE Red U, PANTONE Green U. When tested the above XSLT, the answer is always NO.
No comments:
Post a Comment