diff options
author | Manuel Canales Esparcia <manuel@linuxfromscratch.org> | 2006-04-21 20:24:52 +0000 |
---|---|---|
committer | Manuel Canales Esparcia <manuel@linuxfromscratch.org> | 2006-04-21 20:24:52 +0000 |
commit | dc931cb251714f9f8f8f3c699dd72e80708bc0f3 (patch) | |
tree | 465e0434886d44b7327b1c7919f08ffc8681d95f /stylesheets/xhtml/lfs-sections.xsl | |
parent | 962a927c9e497c6b95bf57700978087a6aefe5a5 (diff) |
Automatized preface pages labeling.
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@7556 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'stylesheets/xhtml/lfs-sections.xsl')
-rw-r--r-- | stylesheets/xhtml/lfs-sections.xsl | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/stylesheets/xhtml/lfs-sections.xsl b/stylesheets/xhtml/lfs-sections.xsl index 210ea0c46..17944124d 100644 --- a/stylesheets/xhtml/lfs-sections.xsl +++ b/stylesheets/xhtml/lfs-sections.xsl @@ -48,12 +48,50 @@ <xsl:call-template name="process.chunk.footnotes"/> </div> </xsl:template> - + <!-- Sections numbering --> <xsl:param name="section.autolabel" select="1"/> <xsl:param name="section.label.includes.component.label" select="1"/> - <!-- Skip numeraration for sections with empty title --> + <!-- Use lowercase roman numbers for sect1 in preface --> + <xsl:template match="sect1" mode="label.markup"> + <!-- if the parent is a component, maybe label that too --> + <xsl:variable name="parent.is.component"> + <xsl:call-template name="is.component"> + <xsl:with-param name="node" select=".."/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="component.label"> + <xsl:if test="$section.label.includes.component.label != 0 + and $parent.is.component != 0"> + <xsl:variable name="parent.label"> + <xsl:apply-templates select=".." mode="label.markup"/> + </xsl:variable> + <xsl:if test="$parent.label != ''"> + <xsl:apply-templates select=".." mode="label.markup"/> + <xsl:apply-templates select=".." mode="intralabel.punctuation"/> + </xsl:if> + </xsl:if> + </xsl:variable> + <xsl:choose> + <xsl:when test="@label"> + <xsl:value-of select="@label"/> + </xsl:when> + <xsl:when test="$section.autolabel != 0"> + <xsl:copy-of select="$component.label"/> + <xsl:choose> + <xsl:when test="ancestor::preface"> + <xsl:number format="i" count="sect1"/> + </xsl:when> + <xsl:otherwise> + <xsl:number format="1" count="sect1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + </xsl:choose> + </xsl:template> + + <!-- Skip numeration for sect2 with empty title --> <xsl:template match="sect2|sect3|sect4|sect5" mode="label.markup"> <xsl:if test="string-length(title) > 0"> <!-- label the parent --> |