![]() |
|
Removing html, head, and body elements from html output
You need to remove the
Customize the template that generates these wrappers.
If you use the chunking stylesheets, customize the
template named “chunk-element-content”
in You will see that these templates generate all three elements. The two examples below remove all three elements and all header and footer content. If you need to just remove one or two of these elements, you can modify the template as necessary. Example 1. Modified chunk-element-content template
<xsl:template name="chunk-element-content">
<xsl:param name="prev"/>
<xsl:param name="next"/>
<xsl:param name="nav.context"/>
<xsl:param name="content">
<xsl:apply-imports/>
</xsl:param>
<xsl:call-template name="user.preroot"/>
<xsl:copy-of select="$content"/>
<xsl:value-of select="$chunk.append"/>
</xsl:template>
Example 2. Modified mode="process.root" template
<xsl:template match="*" mode="process.root">
<xsl:variable name="doc" select="self::*"/>
<xsl:call-template name="user.preroot"/>
<xsl:call-template name="root.messages"/>
<xsl:apply-templates select="."/>
<xsl:value-of select="$html.append"/>
</xsl:template>
The original chunk-element-content and mode="process.root" templates generate all three html wrapper elements and also insert header and footer content. They also allow you to add content before (user.preroot) and after (html.append or chunk.append) other content. The two examples remove all three elements and all header and footer content, but leave in the pre and post content, if any. If you need to just remove one or two of these elements, or you want to keep the header or footer content, you will find that the original templates are reasonably clear and can be modified easily.
| |