Wrap HTML tags in template : html « XSLT stylesheet « XML






Wrap HTML tags in template


File: Data.xml


<poem year="1667" type="epic">
  <verse>line 3</verse>
  <verse>line 4</verse>
</poem>
File: Transform.xslt

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">
  <xsl:output method="xml" omit-xml-declaration="yes" indent="no" />
  
  <xsl:template match="verse">
    <html>
      <body>
        <xsl:apply-templates />
      </body>
    </html>
  </xsl:template>
  
</xsl:stylesheet>

Output:


  <html><body>line 3</body></html>
  <html><body>line 4</body></html>

 








Related examples in the same category

1.Output various html tags
2.Output html img tag
3.One html tag per template
4.Format output with HTML tags
5.Construct image name used by generated HTML in style sheet
6.html output method to make br tags come out as
7.Output html with frameset
8.Transformation of book information into XHTML with sorting
9.Output whole xhtml document
10.Add more format with html tags
11.Format output with font
12.Use blockquote to output value from xml