diff options
author | Michael Stahl <mst@openoffice.org> | 2010-12-22 18:39:38 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2010-12-22 18:39:38 +0100 |
commit | 749032f17b1d29156a0248e54f49462517d03523 (patch) | |
tree | e4c6b2f6f428942da3b27a58adecaa071d091105 /filter/source/docbook | |
parent | 9c16b686c71855df1bbcbf1bcc4b175c48abb49c (diff) |
sw34bf03: #i101360#: patch by dtardon: use xsl:element instead of... WTF?
Diffstat (limited to 'filter/source/docbook')
-rw-r--r-- | filter/source/docbook/sofftodocbookheadings.xsl | 87 |
1 files changed, 34 insertions, 53 deletions
diff --git a/filter/source/docbook/sofftodocbookheadings.xsl b/filter/source/docbook/sofftodocbookheadings.xsl index cfddf901b2d4..3fda55612a05 100644 --- a/filter/source/docbook/sofftodocbookheadings.xsl +++ b/filter/source/docbook/sofftodocbookheadings.xsl @@ -163,20 +163,20 @@ <!-- if the first heading is not of the section1 level --> <xsl:if test="generate-id(.) != generate-id($firstHeading)"> <!-- create an anonymous section1 and embrace all headings preceding the first real existent section1 --> - <xsl:text disable-output-escaping="yes"><sect1></xsl:text> - <title></title> - <!-- create sections for all the first section1 preluding headings --> - <xsl:for-each select="key('getHeadingsByOutline', $section1_OutlineLevel)[1]/preceding::text:h"> - <xsl:call-template name="make-section"> - <xsl:with-param name="previousSectionLevel" select="$section1_OutlineLevel"/> - <xsl:with-param name="currentSectionLevel"> - <xsl:call-template name="getSectionLevel"> - <xsl:with-param name="outlineLevel" select="@text:level"/> - </xsl:call-template> - </xsl:with-param> - </xsl:call-template> - </xsl:for-each> - <xsl:text disable-output-escaping="yes"></sect1></xsl:text> + <xsl:element name="sect1"> + <title></title> + <!-- create sections for all the first section1 preluding headings --> + <xsl:for-each select="key('getHeadingsByOutline', $section1_OutlineLevel)[1]/preceding::text:h"> + <xsl:call-template name="make-section"> + <xsl:with-param name="previousSectionLevel" select="$section1_OutlineLevel"/> + <xsl:with-param name="currentSectionLevel"> + <xsl:call-template name="getSectionLevel"> + <xsl:with-param name="outlineLevel" select="@text:level"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </xsl:for-each> + </xsl:element> </xsl:if> </xsl:for-each> <!-- match all headings, which are mapped to section1 to create a nested section structure used in docbook (see first comment after copyright) --> @@ -278,30 +278,22 @@ <xsl:choose> <!-- empty title as it is an empty section between two headings with an outline level difference higher than 1 --> <xsl:when test="$currentSectionLevel > $previousSectionLevel+1"> - <xsl:text disable-output-escaping="yes"><sect</xsl:text> - <xsl:value-of select="$previousSectionLevel +1"/> - <xsl:text disable-output-escaping="yes">></xsl:text> - <title></title> - <xsl:call-template name="make-section"> - <xsl:with-param name="currentSectionLevel" select="$currentSectionLevel"/> - <xsl:with-param name="previousSectionLevel" select="$previousSectionLevel +1"/> - </xsl:call-template> - <xsl:text disable-output-escaping="yes"></sect</xsl:text> - <xsl:value-of select="$previousSectionLevel +1"/> - <xsl:text disable-output-escaping="yes">></xsl:text> + <xsl:element name="{concat('sect', $previousSectionLevel + 1)}"> + <title></title> + <xsl:call-template name="make-section"> + <xsl:with-param name="currentSectionLevel" select="$currentSectionLevel"/> + <xsl:with-param name="previousSectionLevel" select="$previousSectionLevel +1"/> + </xsl:call-template> + </xsl:element> </xsl:when> <xsl:otherwise> - <xsl:text disable-output-escaping="yes"><sect</xsl:text> - <xsl:value-of select="$currentSectionLevel"/> - <xsl:text disable-output-escaping="yes">></xsl:text> - <title> - <xsl:apply-templates/> - </title> - <xsl:apply-templates select="key('nestedContent', generate-id())"/> - <xsl:apply-templates select="key('nestedHeadings', generate-id())" mode="recreateStructure"/> - <xsl:text disable-output-escaping="yes"></sect</xsl:text> - <xsl:value-of select="$currentSectionLevel"/> - <xsl:text disable-output-escaping="yes">></xsl:text> + <xsl:element name="{concat('sect', $currentSectionLevel)}"> + <title> + <xsl:apply-templates/> + </title> + <xsl:apply-templates select="key('nestedContent', generate-id())"/> + <xsl:apply-templates select="key('nestedHeadings', generate-id())" mode="recreateStructure"/> + </xsl:element> </xsl:otherwise> </xsl:choose> </xsl:template> @@ -370,23 +362,12 @@ </appendix> </xsl:when> <xsl:otherwise> - <xsl:variable name="sectvar"> - <xsl:text>sect</xsl:text> - <xsl:value-of select="count(ancestor::text:section)+1"/> - </xsl:variable> - <xsl:variable name="idvar"> - <xsl:text> id="</xsl:text> - <xsl:value-of select="@text:name"/> - <xsl:text>"</xsl:text> - </xsl:variable> - <xsl:text disable-output-escaping="yes"><</xsl:text> - <xsl:value-of select="$sectvar"/> - <xsl:value-of select="$idvar"/> - <xsl:text disable-output-escaping="yes">></xsl:text> - <xsl:apply-templates/> - <xsl:text disable-output-escaping="yes"></</xsl:text> - <xsl:value-of select="$sectvar"/> - <xsl:text disable-output-escaping="yes">></xsl:text> + <xsl:element name="{concat('sect', count(ancestor::text:section) + 1)}"> + <xsl:attribute name="id"> + <xsl:value-of select="@text:name"/> + </xsl:attribute> + <xsl:apply-templates/> + </xsl:element> </xsl:otherwise> </xsl:choose> </xsl:template> |