One html tag per template : html « XSLT stylesheet « XML






One html tag per template


File: Data.xml


File: Transform.xslt

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">

  <xsl:template match="emphasis">
    <b>
      <xsl:apply-templates />
    </b>
  </xsl:template>

  <xsl:template match="literal">
    <tt>
      <xsl:apply-templates />
    </tt>
  </xsl:template>

  <xsl:template match="chapter">
    <html>
      <xsl:apply-templates />
    </html>
  </xsl:template>

  <xsl:template match="para">
    <p>
      <xsl:apply-templates />
    </p>
  </xsl:template>

  <xsl:template match="chapter/title">
    <h1>
      <xsl:apply-templates />
    </h1>
  </xsl:template>

</xsl:stylesheet>

 








Related examples in the same category

1.Output various html tags
2.Output html img tag
3.Wrap HTML tags in 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