rvdokkum Posted June 2, 2011 Share Posted June 2, 2011 i like to test the value of an attributehow do i check if the value of attribute type="audio"this is what my xml looks like <tumblr><posts><post type="audio"><audio-caption>.... this i my attempt that is not working <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"> <h2>Blog</h2> <table> <xsl:for-each select="tumblr/posts/post"> <tr> <td> <xsl:if test="tumblr/posts/post/@type='audio'"> <xsl:text>audio node</xsl:text> </xsl:if> </td> </tr> </xsl:for-each> </table></xsl:template></xsl:stylesheet> Link to comment Share on other sites More sharing options...
Martin Honnen Posted June 2, 2011 Share Posted June 2, 2011 Well your for-each changes the context node so inside it to check the 'type' attribute you simply need <xsl:if test="@type = 'audio'">...</xsl:if> Link to comment Share on other sites More sharing options...
rvdokkum Posted June 2, 2011 Author Share Posted June 2, 2011 Well your for-each changes the context node so inside it to check the 'type' attribute you simply need<xsl:if test="@type = 'audio'">...</xsl:if> thanksi see i also got my quotes messed up at the end of audio'all working Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.