html output method to make br tags come out as
: html « XSLT stylesheet « XML






html output method to make br tags come out as



File: Data.xml
<wine grape="Cabernet">
  <winery>shop 1</winery>
  <product>product 1</product>
  <year>1996</year>
  <price>11.99</price>
</wine>

File: Transform.xslt
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">
  <xsl:output method="html" />
  <xsl:template match="winery">
    <b>
      <font size="10pt">
        <xsl:apply-templates />
        <xsl:text> </xsl:text>
        <xsl:value-of select="../@grape" />
      </font>
    </b>
    <br />
  </xsl:template>

  <xsl:template match="product">
    <i>
      <font size="10pt">
        <xsl:apply-templates />
      </font>
    </i>
    <br />
  </xsl:template>

  <xsl:template match="year | price">
    <font size="10pt">
      <xsl:apply-templates />
    </font>
    <br />
  </xsl:template>
  
</xsl:stylesheet>

Output:


  <b><font size="10pt">shop 1 Cabernet</font></b><br>
  <i><font size="10pt">product 1</font></i><br>
  <font size="10pt">1996</font><br>
  <font size="10pt">11.99</font><br>

 








Related examples in the same category

1.Output various html tags
2.Output html img tag
3.One html tag per template
4.Wrap HTML tags in template
5.Format output with HTML tags
6.Construct image name used by generated HTML in style sheet
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