sectX Elements into section ElementsYou need to transform every sectX element into a
section element.
This problem is solved through the following XSLT stylesheet:
sectX Element into a
section Element<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:d="http://docbook.org/ns/docbook"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="copy.xsl"/>
<xsl:template match="d:sect1|d:sect2|d:sect3|d:sect4|d:sect5">
<xsl:element name="section" namespace="http://docbook.org/ns/docbook">
<xsl:apply-templates select="node()"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
The stylesheet from Example 3.10, “Transforms every sectX Element into a
section Element” is very easy: it
imports the standard rules to copy every node from
copy.xsl and create special rules for all
sectX elements. As every sectX element
creates the same structure, we can collect it in one template
rule.
| Project@GitHub | Issue#8 |