Skip empty XML nodes


/ Published in: XSLT
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <xsl:template name="getValue">
  2. <xsl:param name="tagId"></xsl:param>
  3. <xsl:choose>
  4. <xsl:when test="normalize-space(//item[@id=$tagId]) != ''">
  5. not empty
  6. </xsl:when>
  7. <xsl:otherwise>
  8. EMPTY
  9. </xsl:otherwise>
  10. </xsl:choose>
  11. Value:<xsl:value-of select="string(//item[@id=$tagId])"/>:
  12. </xsl:template>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.