| 1 |
Index: filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
|
| 2 |
===================================================================
|
| 3 |
--- filter/source/xslt/odf2xhtml/export/xhtml/body.xsl (revision 270524)
|
| 4 |
+++ filter/source/xslt/odf2xhtml/export/xhtml/body.xsl (working copy)
|
| 5 |
@@ -1735,6 +1735,11 @@
|
| 6 |
<xsl:param name="minLabelWidth"/>
|
| 7 |
<xsl:param name="listIndent" />
|
| 8 |
|
| 9 |
+ <!-- The text:list-header shall not be labeled. According to ODF specification (sect. 4.3.2):
|
| 10 |
+ "The <text:list-header> element represents a list header and is a special kind of list item. It
|
| 11 |
+ contains one or more paragraphs that are displayed before a list. The paragraphs are formatted
|
| 12 |
+ like list items but they do not have a preceding number or bullet." -->
|
| 13 |
+ <xsl:variable name="isListHeader" select="boolean(self::text:list-header)"/>
|
| 14 |
|
| 15 |
<xsl:variable name="listIndentNew">
|
| 16 |
<xsl:choose>
|
| 17 |
@@ -1753,13 +1758,16 @@
|
| 18 |
<xsl:variable name="itemNumberNew">
|
| 19 |
<xsl:if test="$listStyle/text:list-style/text:list-level-style-number">
|
| 20 |
<xsl:choose>
|
| 21 |
+ <xsl:when test="$isListHeader">0</xsl:when>
|
| 22 |
<xsl:when test="$isEmptyList">
|
| 23 |
<!-- An empty list item (no text:h/text:p as child), will not count as item and does not increment the count. -->
|
| 24 |
<xsl:variable name="tempItemNumber">
|
| 25 |
<xsl:choose>
|
| 26 |
<!-- siblings will be incremented by one -->
|
| 27 |
<xsl:when test="$itemNumber">
|
| 28 |
- <xsl:value-of select="$itemNumber + 1"/>
|
| 29 |
+ <xsl:if test="not($isListHeader)">
|
| 30 |
+ <xsl:value-of select="$itemNumber + 1"/>
|
| 31 |
+ </xsl:if>
|
| 32 |
</xsl:when>
|
| 33 |
<!-- if a higher list level had content the numbering starts with 1 -->
|
| 34 |
<xsl:when test="$isListNumberingReset and $listLevel > 1">
|
| 35 |
@@ -1834,6 +1842,7 @@
|
| 36 |
<xsl:when test="$display">
|
| 37 |
<xsl:value-of select="$display"/>
|
| 38 |
</xsl:when>
|
| 39 |
+ <xsl:when test="$isListHeader">0</xsl:when>
|
| 40 |
<xsl:otherwise>1</xsl:otherwise>
|
| 41 |
</xsl:choose>
|
| 42 |
</xsl:with-param>
|
| 43 |
@@ -1844,9 +1853,10 @@
|
| 44 |
</xsl:variable>
|
| 45 |
<xsl:element name="li">
|
| 46 |
<xsl:choose>
|
| 47 |
- <xsl:when test="$isEmptyList">
|
| 48 |
+ <xsl:when test="$isEmptyList or $isListHeader">
|
| 49 |
<xsl:apply-templates>
|
| 50 |
<xsl:with-param name="globalData" select="$globalData"/>
|
| 51 |
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isListHeader or $isNextLevelNumberingReset"/>
|
| 52 |
<xsl:with-param name="itemLabel" select="$itemLabelNew"/>
|
| 53 |
<xsl:with-param name="listLevel" select="$listLevel + 1"/>
|
| 54 |
<xsl:with-param name="listStyleName" select="$listStyleName"/>
|
| 55 |
@@ -1857,7 +1867,7 @@
|
| 56 |
<xsl:apply-templates mode="list-item-children" select="*[1]">
|
| 57 |
<xsl:with-param name="globalData" select="$globalData"/>
|
| 58 |
<xsl:with-param name="isEmptyList" select="$isEmptyList"/>
|
| 59 |
- <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
|
| 60 |
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isListHeader or $isNextLevelNumberingReset"/>
|
| 61 |
<!-- The new created label is given to the children -->
|
| 62 |
<xsl:with-param name="itemLabel" select="$itemLabelNew"/>
|
| 63 |
<xsl:with-param name="listLabelElement">
|
| 64 |
@@ -2056,7 +2066,7 @@
|
| 65 |
|
| 66 |
|
| 67 |
<!-- The Numbering start value (or offset from regular counteing) is used at the first item of offset,
|
| 68 |
- but have to be reused on following item/headers with no text:start-value -->
|
| 69 |
+ but have to be reused on following items with no text:start-value -->
|
| 70 |
<xsl:template name="getItemNumber">
|
| 71 |
<xsl:param name="listLevel"/>
|
| 72 |
<xsl:param name="listLevelStyle"/>
|
| 73 |
@@ -2091,6 +2101,9 @@
|
| 74 |
the level 3 gets a 'pseudoLevel' -->
|
| 75 |
<xsl:param name="pseudoLevel" select="0" />
|
| 76 |
|
| 77 |
+ <xsl:variable name="isListHeader" select="boolean(self::text:list-header)"/>
|
| 78 |
+ <xsl:variable name="isEmptyList" select="not(*[name() = 'text:h' or name() = 'text:p'])"/>
|
| 79 |
+
|
| 80 |
<!-- set the next of preceding list items. Starting from the current to the next previous text:list-item -->
|
| 81 |
<xsl:variable name="precedingListItemOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle[$precedingListItemsOfSameLevelAndStyleCount - $IteratorSameLevelAndStyle + 1]"/>
|
| 82 |
<xsl:variable name="precedingListItemOfSameStyle" select="$precedingListItemsOfSameStyle[$precedingListItemsOfSameStyleCount - $IteratorSameStyle + 1]"/>
|
| 83 |
@@ -2123,7 +2136,7 @@
|
| 84 |
<xsl:when test="$currentListLevel < $listLevel">
|
| 85 |
<xsl:choose>
|
| 86 |
<!-- if it has content the counting is ended -->
|
| 87 |
- <xsl:when test="*[name() = 'text:h' or name() = 'text:p']">
|
| 88 |
+ <xsl:when test="not($isEmptyList or $isListHeader)">
|
| 89 |
<!-- 2DO: Perhaps the children still have to be processed -->
|
| 90 |
<xsl:value-of select="$itemNumber + $pseudoLevel"/>
|
| 91 |
</xsl:when>
|
| 92 |
@@ -2178,7 +2191,7 @@
|
| 93 |
<xsl:with-param name="pseudoLevel">
|
| 94 |
<xsl:choose>
|
| 95 |
<!-- empty list item does not count -->
|
| 96 |
- <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
|
| 97 |
+ <xsl:when test="$isEmptyList or $isListHeader">
|
| 98 |
<xsl:value-of select="$pseudoLevel"/>
|
| 99 |
</xsl:when>
|
| 100 |
<xsl:otherwise>1</xsl:otherwise>
|
| 101 |
@@ -2211,11 +2224,14 @@
|
| 102 |
<xsl:param name="precedingListItemsOfSameStyleCount"/>
|
| 103 |
<xsl:param name="pseudoLevel" />
|
| 104 |
|
| 105 |
+ <xsl:variable name="isListHeader" select="boolean(self::text:list-header)"/>
|
| 106 |
+ <xsl:variable name="isEmptyList" select="not(*[name() = 'text:h' or name() = 'text:p'])"/>
|
| 107 |
+
|
| 108 |
<xsl:choose>
|
| 109 |
<xsl:when test="@text:start-value">
|
| 110 |
<xsl:choose>
|
| 111 |
- <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
|
| 112 |
- <!-- empty list item does not count -->
|
| 113 |
+ <xsl:when test="$isEmptyList or $isListHeader">
|
| 114 |
+ <!-- empty list item does not count. neither does list header -->
|
| 115 |
<xsl:call-template name="countListItemTillStartValue">
|
| 116 |
<xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
|
| 117 |
<xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
|
| 118 |
@@ -2237,8 +2253,8 @@
|
| 119 |
</xsl:when>
|
| 120 |
<xsl:when test="$listLevelStyle/@text:start-value">
|
| 121 |
<xsl:choose>
|
| 122 |
- <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
|
| 123 |
- <!-- empty list item does not count -->
|
| 124 |
+ <xsl:when test="$isEmptyList or $isListHeader">
|
| 125 |
+ <!-- empty list item does not count. neither does list header -->
|
| 126 |
<xsl:call-template name="countListItemTillStartValue">
|
| 127 |
<xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
|
| 128 |
<xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
|
| 129 |
@@ -2260,8 +2276,8 @@
|
| 130 |
</xsl:when>
|
| 131 |
<xsl:otherwise>
|
| 132 |
<xsl:choose>
|
| 133 |
- <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
|
| 134 |
- <!-- empty list item does not count -->
|
| 135 |
+ <xsl:when test="$isEmptyList or $isListHeader">
|
| 136 |
+ <!-- empty list item does not count. neither does list header -->
|
| 137 |
<xsl:call-template name="countListItemTillStartValue">
|
| 138 |
<xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
|
| 139 |
<xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
|
| 140 |
@@ -2838,4 +2854,4 @@
|
| 141 |
<xsl:template match="math:annotation" mode="math"/>
|
| 142 |
|
| 143 |
|
| 144 |
-</xsl:stylesheet>
|
| 145 |
\ No newline at end of file
|
| 146 |
+</xsl:stylesheet>
|