I am trying to test to see if a HTML element exists within XSLT but cannot get it to work. I am currently trying to assign a variable based on whether it can find it like this:
<xsl:variable name="TestParaText">
<xsl:choose>
<xsl:when test="contains(smf:body,index[@id='testSpan'])">
<xsl:value-of select="'Element found'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'Element Not Found'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Within my HTML I have this:
<span id="testSpan" style="display:none"></span>
I do not want the element to be visible so I have set a style attribute, but I am pretty sure its something to do with my poor xpath / XSLT syntax! Apologies, as I am not very knowledgeable on this topic but hopefully I should of provided enough information for someone to help me. Thanks
If below is ur XML
INPUT XML :
XSL:
OUTPUT will be :
OUTPUT:
Please share ur request xml and expected OUTPUT