Mega Code Archive

 
Categories / XML Tutorial / XSLT StyleSheet
 

Output method=text

File: Data.xml <chapter>   <title>The Chapter</title>   <sect1>     <title>First Section</title>     <figure>       <title>First picture in book</title>       <graphic fileref="pic1.jpg" />     </figure>   </sect1> </chapter> File: Transform.xslt <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"   version="1.0">   <xsl:output method="text" />   <xsl:strip-space elements="*" />   <xsl:template match="sect2[figure]">     <xsl:value-of select="title" />     [     <xsl:apply-templates />     ]   </xsl:template> </xsl:stylesheet> Output: The ChapterFirst SectionFirst picture in book