Mega Code Archive

 
Categories / XML / XSLT StyleSheet
 

If there is an attribute

File: Data.xml <para color="blue" flavor="mint" author="jm">   test </para> File: Transform.xslt <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"   version="1.0">   <xsl:output method="text" />   <xsl:template match="para">     <xsl:if test="@flavor">flavor</xsl:if>     <xsl:if test="@font">font</xsl:if>     <xsl:if test="@author = 'jm'">author</xsl:if>   </xsl:template> </xsl:stylesheet> Output: flavorauthor