diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/xml-to-html.xsl | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/xml-to-html.xsl b/tools/xml-to-html.xsl index 918cc49..261397f 100644 --- a/tools/xml-to-html.xsl +++ b/tools/xml-to-html.xsl @@ -2,7 +2,9 @@ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" + xmlns:str="http://exslt.org/strings" xmlns="http://www.w3.org/1999/xhtml" + extension-element-prefixes="str" version="1.0"> <xsl:output method="xml" indent="yes"/> @@ -127,6 +129,16 @@ </dd> </xsl:template> + <xsl:template mode="body" match="xhtml:h1|xhtml:h2|xhtml:h3|xhtml:h4|xhtml:h5"> + <xsl:copy> + <xsl:attribute name="id"> + <xsl:value-of select="str:replace(text(),' ','_')"/> + </xsl:attribute> + <xsl:copy-of select="@*" /> + <xsl:apply-templates mode="body" /> + </xsl:copy> + </xsl:template> + <xsl:template mode="body" match="node()" priority="0"> <xsl:copy> <xsl:copy-of select="@*" /> |