<bloco>
<item nome="imagem">true</item>
<item nome="imagem">false</item>
</bloco>
<bloco>
<item nome="imagem">true</item>
<item nome="imagem">false</item>
</bloco>
Use a template to select all elements item
, test content value (using .
or node()
or text()
) and print the value of the nome
attribute if the content is equal to the string 'true'
.
Here is an example style sheet:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.0">
<xsl:output method="text"/>
<xsl:strip-space elements="*"/>
<xsl:template match="item">
<xsl:if test=". = 'true'">
<xsl:value-of select="@nome" />
</xsl:if>
</xsl:template>
</xsl:stylesheet>