Adding HTML headers to XSL files

Sometimes, you may want to produce an HTML file (from an XML document) using your XSL file. To do so, you can create a template that contains the <html> header together with the appropriate <xsl:output> element.

Before you begin

About this task

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:

Procedure

  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.

Results

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.

What to do next


Feedback