Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
glorieux-f committed Apr 3, 2024
1 parent ec0cc00 commit a77f098
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
32 changes: 24 additions & 8 deletions docx/docx_teilike.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@
<xsl:apply-templates select="*[1]"/>
</xsl:template>
<xsl:template match="mc:Fallback"/>
<!-- Recursive search for title level -->
<xsl:template name="lvl">
<xsl:param name="w:style" select="nonode"/>
<xsl:choose>
<xsl:when test="$w:style/w:pPr/w:outlineLvl/@w:val">
<xsl:value-of select="$w:style/w:pPr/w:outlineLvl/@w:val"/>
</xsl:when>
<xsl:when test="$w:style/w:basedOn">
<xsl:call-template name="lvl">
<xsl:with-param name="w:style" select="key('w:style', $w:style/w:basedOn)"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- block -->
<xsl:template match="w:p">
<xsl:variable name="w:style" select="key('w:style', w:pPr/w:pStyle/@w:val)"/>
Expand All @@ -98,7 +112,9 @@
<xsl:value-of select="$id"/>
</xsl:variable>
<xsl:variable name="teinte_p" select="key('teinte_p', $style_name)"/>
<xsl:variable name="lvl" select="$w:style/w:pPr/w:outlineLvl/@w:val"/>
<xsl:variable name="lvl">
<xsl:call-template name="lvl"/>
</xsl:variable>
<xsl:choose>
<!-- para in table cell -->
<xsl:when test="ancestor::w:tc">
Expand Down Expand Up @@ -144,7 +160,13 @@
<xsl:apply-templates select="w:hyperlink | w:r"/>
</p>
</xsl:when>
<!-- known semantic style names, should not be structuring heading -->
<!-- known semantic style names, should not be structuring heading (?) -->
<!-- Bug lev -->
<xsl:when test="number($lvl) &gt; 0 and number($lvl) &lt; 9 and not(ancestor::w:tc|ancestor::w:footnote)">
<head level="{$lvl+1}">
<xsl:apply-templates select="w:hyperlink | w:r"/>
</head>
</xsl:when>
<xsl:when test="$teinte_p/@parent != ''">
<xsl:element name="{$teinte_p/@parent}">
<!-- atts on parent -->
Expand Down Expand Up @@ -176,12 +198,6 @@
<xsl:apply-templates select="w:hyperlink | w:r"/>
</xsl:element>
</xsl:when>
<!-- Bug lev -->
<xsl:when test="number($lvl) &gt; 0 and number($lvl) &lt; 9 and not(ancestor::w:tc|ancestor::w:footnote)">
<head level="{$lvl+1}">
<xsl:apply-templates select="w:hyperlink | w:r"/>
</head>
</xsl:when>
<!-- some heading may hav set list item, TODO listStyle, see in w:pPr/w:numPr/w:numId/@w:val -->
<xsl:when test="w:pPr/w:numPr">
<xsl:variable name="w:ilvl" select="number(w:pPr/w:numPr/w:ilvl/@w:val)"/>
Expand Down
1 change: 1 addition & 0 deletions docx/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ LGPL http://www.gnu.org/licenses/lgpl.html
<style level="0" name="corpsdetexte"/>
<style level="0" name="corpsdutexte"/>
<style level="0" name="defaultparagraphfont"/>
<style level="0" name="footnotecharacters"/>
<style level="0" name="footnotereference"/>
<style level="0" name="freeform"/>
<style level="0" name="legendedelimage"/>
Expand Down

0 comments on commit a77f098

Please sign in to comment.