Output html img tag : html « XSLT stylesheet « XML






Output html img tag



File: Data.xml


<xdata>
</xdata>


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" />
  <xsl:template match="xdata">
    <section>
      <xsl:element name="author">
        <xsl:attribute namespace="http://www.w3.org/1999/xlink"
          name="type">simple</xsl:attribute>
        <xsl:attribute namespace="http://www.w3.org/1999/xlink"
          name="href">a.html</xsl:attribute>
      </xsl:element>
      <xsl:apply-templates />
    </section>
  </xsl:template>
</xsl:stylesheet>

Output:


  
<section><author xmlns:ns0="http://www.w3.org/1999/xlink" ns0:type="simple" ns0:href="a.html"/>

</section>
  

 








Related examples in the same category

1.Output various html tags
2.One html tag per template
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