Adding an HTML header to your XSL file

Sometimes, you may want to produce an HTML file using your XSL file. You can easily create a template that contains the <html> header together with the appropriate <xsl:output> element.

The following instructions were written for the Resource perspective, but they will also work in many other perspectives.

Follow these steps to add an HTML template to your XSL file:

  1. Open your XSL file in the XSL editor.

  2. Click the Snippets tab, open the XSL drawer, and then double-click Default HTML header.

The following text will appear in the XSL file:

<xsl:output method="html" encoding="UTF-8"/>
<xsl:template match="/"> 
 <html> 
<head> 
   <title>Untitled</title> 
 </head> 
     <body> 
   <xsl:apply-templates/> 
     </body> 
</html> 
 </xsl:template>

The <xsl:apply-templates/> element will recursively process all the children of the XML document you apply your XSL file to.

 

Parent topic

Editing XSL files