diff options
author | Oliver Bolte <obo@openoffice.org> | 2004-11-18 09:15:40 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2004-11-18 09:15:40 +0000 |
commit | e1a5804187842395187b7f5dfe9a0f0607497c0d (patch) | |
tree | 58a73ec8cf14d41188ce458a7d43f04c459eae3b | |
parent | 0857f1136f45959f80a560a54725120b16ace7c9 (diff) |
INTEGRATION: CWS xsltfilter04 (1.2.34); FILE MERGED
2004/11/10 11:03:04 sus 1.2.34.7: #118261# removing updates without QA
2004/11/09 07:16:58 gyang 1.2.34.6: fix for Oasis format, now only one error remaining
2004/11/08 11:04:25 gyang 1.2.34.5: fix for Oasis format
2004/11/05 04:56:56 gyang 1.2.34.4: wordml fix for strict OASIS format
2004/11/04 10:24:55 gyang 1.2.34.3: fix for i36102
2004/11/04 04:34:14 gyang 1.2.34.2: fix for oot validate
2004/11/03 08:55:56 gyang 1.2.34.1: wordmlf filter migrates from OOo format to OASIS format
-rw-r--r-- | filter/source/xslt/import/wordml/wordml2ooo_list.xsl | 300 |
1 files changed, 235 insertions, 65 deletions
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_list.xsl b/filter/source/xslt/import/wordml/wordml2ooo_list.xsl index 14e62017c3bb..0cafab108d90 100644 --- a/filter/source/xslt/import/wordml/wordml2ooo_list.xsl +++ b/filter/source/xslt/import/wordml/wordml2ooo_list.xsl @@ -51,7 +51,7 @@ Contributor(s): _______________________________________ --> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:text="http://openoffice.org/2000/text" xmlns:style="http://openoffice.org/2000/style" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="w wx v text style fo"> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:openoffice:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:openoffice:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:openoffice:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:openoffice:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:openoffice:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:openoffice:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:openoffice:xmlns:datastyle:1.0" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="urn:oasis:names:tc:openoffice:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:openoffice:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:openoffice:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:openoffice:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:openoffice:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt fo v"> <xsl:template match="w:listPr" mode="style"> <xsl:variable name="currlistid" select="w:ilfo/@w:val"/> <xsl:variable name="currlist" select="."/> @@ -59,7 +59,8 @@ <xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/> <xsl:if test="not(ancestor::w:p/preceding-sibling::w:p/w:pPr/w:listPr[1]/w:ilfo/@w:val= $currlistid) and $rootlist/w:lvl "> <xsl:element name="text:list-style"> - <xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::w:listPr)"/></xsl:attribute> + <xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::w:listPr)"/> + </xsl:attribute> <xsl:apply-templates select="$rootlist/w:lvl"/> </xsl:element> </xsl:if> @@ -104,19 +105,44 @@ <xsl:param name="listtype"/> <xsl:param name="currlevel"/> <xsl:variable name="startval" select="w:start/@w:val"/> - <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute> + <xsl:attribute name="text:level"> + <xsl:value-of select="$currlevel"/> + </xsl:attribute> <xsl:choose> <xsl:when test="$listtype = 23"> <!-- bullet character. glu --> - <xsl:attribute name="text:style-name">Bullet Symbols</xsl:attribute> - <xsl:attribute name="text:bullet-char"><xsl:value-of select="w:lvlText/@w:val"/></xsl:attribute> + <xsl:attribute name="text:style-name">Bullet_20_Symbols</xsl:attribute> + <xsl:if test="not (contains(w:lvlText/@w:val,'%'))"> + <xsl:attribute name="text:bullet-char"> + <xsl:value-of select="w:lvlText/@w:val"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="contains(w:lvlText/@w:val,'%')"> + <xsl:attribute name="text:bullet-char"> + <xsl:value-of select=" '·' "/> + </xsl:attribute> + </xsl:if> </xsl:when> <xsl:when test="($listtype >= 0) and ($listtype < 60)"> - <xsl:attribute name="text:style-name">Numbering Symbols</xsl:attribute> + <xsl:attribute name="text:style-name">Numbering_20_Symbols</xsl:attribute> <xsl:if test="$startval"> - <xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute> + <xsl:choose> + <xsl:when test="$startval > 0"> + <xsl:attribute name="text:start-value"> + <xsl:value-of select="$startval"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:start-value"> + <xsl:value-of select=" '1' "/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <!--xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute --> </xsl:if> - <xsl:attribute name="text:display-levels"><xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') )"/></xsl:attribute> + <xsl:attribute name="text:display-levels"> + <xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') ) + 1"/> + </xsl:attribute> <xsl:call-template name="nfc2numformat"> <xsl:with-param name="nfcvalue" select="$listtype"/> <xsl:with-param name="prefix" select="substring-before(w:lvlText/@w:val, '%')"/> @@ -124,18 +150,36 @@ </xsl:call-template> </xsl:when> <xsl:otherwise> - <xsl:attribute name="text:style-name">Numbering Symbols</xsl:attribute> + <xsl:attribute name="text:style-name">Numbering_20_Symbols</xsl:attribute> <xsl:if test="$startval"> - <xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute> + <xsl:choose> + <xsl:when test="$startval > 0"> + <xsl:attribute name="text:start-value"> + <xsl:value-of select="$startval"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:start-value"> + <xsl:value-of select=" '1' "/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <!-- xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute --> </xsl:if> - <xsl:attribute name="text:display-levels"><xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') )"/></xsl:attribute> + <xsl:attribute name="text:display-levels"> + <xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') ) + 1"/> + </xsl:attribute> <!-- 'none' in Word 2003. wym --> <xsl:attribute name="style:num-format"/> - <xsl:attribute name="style:num-prefix"><xsl:value-of select="substring-before(w:lvlText/@w:val, '%')"/></xsl:attribute> - <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(w:lvlText/@w:val, concat('%', $currlevel + 1) )"/></xsl:attribute> + <xsl:attribute name="style:num-prefix"> + <xsl:value-of select="substring-before(w:lvlText/@w:val, '%')"/> + </xsl:attribute> + <xsl:attribute name="style:num-suffix"> + <xsl:value-of select="substring-after(w:lvlText/@w:val, concat('%', $currlevel + 1) )"/> + </xsl:attribute> </xsl:otherwise> </xsl:choose> - <xsl:element name="style:properties"> + <xsl:element name="style:list-level-properties"> <xsl:choose> <xsl:when test="w:lvlJc/@w:val='right'"> <xsl:attribute name="fo:text-align">end</xsl:attribute> @@ -150,25 +194,36 @@ <xsl:variable name="labelwidth"> <xsl:choose> <xsl:when test="w:pPr/w:ind/@w:hanging"> - <xsl:call-template name="convert2cm"> - <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'dxa')"/> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'twip')"/> </xsl:call-template> </xsl:when> <xsl:when test="w:pPr/w:ind/@w:first-line"> - <xsl:call-template name="convert2cm"> - <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'dxa')"/> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'twip')"/> </xsl:call-template> </xsl:when> <xsl:otherwise>0</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="leftwidth"> - <xsl:call-template name="convert2cm"> - <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'dxa')"/> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'twip')"/> </xsl:call-template> </xsl:variable> - <xsl:attribute name="text:space-before"><xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/></xsl:attribute> - <xsl:attribute name="text:min-label-width"><xsl:choose><xsl:when test="$labelwidth > 0"><xsl:value-of select="concat($labelwidth,'cm')"/></xsl:when><xsl:otherwise>0cm</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="w:pPr/w:ind/@w:left"> + <xsl:attribute name="text:space-before"> + <xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="text:min-label-width"> + <xsl:choose> + <xsl:when test="$labelwidth > 0"> + <xsl:value-of select="concat($labelwidth,'cm')"/> + </xsl:when> + <xsl:otherwise>0cm</xsl:otherwise> + </xsl:choose> + </xsl:attribute> <!-- In binary word translation, text:min-label-distance do not generate. So, the width of number-symbol will not effect the start position of text. But first line always start same position of second line, no indent. If text:min-label-distance generate, the look of list will change because of uncountable number-symbol's width, now use 0.25cm as default width--> <xsl:choose> <xsl:when test="w:suff/@w:val='Space'"> @@ -176,12 +231,22 @@ </xsl:when> <xsl:when test="w:pPr/w:tabs/w:tab/@w:pos"> <xsl:variable name="tabpos"> - <xsl:call-template name="convert2cm"> - <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'dxa')"/> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'twip')"/> </xsl:call-template> </xsl:variable> <xsl:if test="number($tabpos) > (number($leftwidth)-number($labelwidth))"> - <xsl:attribute name="text:min-label-distance"><xsl:value-of select="concat(number($tabpos)+number($labelwidth)-number($leftwidth)-0.25,'cm')"/></xsl:attribute> + <xsl:variable name="min-label-distance"> + <xsl:choose> + <xsl:when test="number($tabpos)+number($labelwidth)-number($leftwidth)-0.25 < 0">0</xsl:when> + <xsl:otherwise> + <xsl:value-of select="number($tabpos)+number($labelwidth)-number($leftwidth)-0.25"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="text:min-label-distance"> + <xsl:value-of select="concat($min-label-distance,'cm')"/> + </xsl:attribute> </xsl:if> </xsl:when> </xsl:choose> @@ -199,68 +264,97 @@ </xsl:choose>--> <xsl:if test="w:rPr/w:rFonts"> <xsl:if test="w:rPr/w:rFonts/@w:ascii"> - <xsl:attribute name="style:font-name"><xsl:value-of select="w:rPr/w:rFonts/@w:ascii"/></xsl:attribute> + <xsl:attribute name="style:font-name"> + <xsl:value-of select="w:rPr/w:rFonts/@w:ascii"/> + </xsl:attribute> </xsl:if> - <xsl:if test="w:rPr/w:rFonts/@w:fareast"> + <!-- in Oasis format the style:font-name-asian is not allowed to appear here --> + <!--xsl:if test="w:rPr/w:rFonts/@w:fareast"> <xsl:attribute name="style:font-name-asian"><xsl:value-of select="w:rPr/w:rFonts/@w:fareast"/></xsl:attribute> - </xsl:if> + </xsl:if --> + <!-- <xsl:if test="w:rPr/w:rFonts/@w:cs"> <xsl:attribute name="style:font-name-complex"><xsl:value-of select="w:rPr/w:rFonts/@w:cs"/></xsl:attribute> </xsl:if> + --> </xsl:if> </xsl:element> </xsl:template> <xsl:template name="list-styles-image"> <xsl:variable name="currlevel" select="number(@w:ilvl)"/> - <xsl:attribute name="text:level"><xsl:value-of select="$currlevel+1"/></xsl:attribute> + <xsl:attribute name="text:level"> + <xsl:value-of select="$currlevel+1"/> + </xsl:attribute> <xsl:variable name="picid" select="w:lvlPicBulletId/@w:val"/> - <xsl:element name="style:properties"> + <office:binary-data> + <xsl:value-of select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/w:binData"/> + </office:binary-data> + <xsl:element name="style:list-level-properties"> <xsl:attribute name="style:vertical-pos">middle</xsl:attribute> <xsl:attribute name="style:vertical-rel">line</xsl:attribute> <xsl:variable name="picsize" select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/v:shape/@style"/> - <xsl:attribute name="fo:width"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="substring-before(substring-after($picsize,'width:'), ';')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute> - <xsl:attribute name="fo:height"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="substring-after($picsize,'height:')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute> + <xsl:attribute name="fo:text-align">left</xsl:attribute> + <xsl:attribute name="fo:width"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="substring-before(substring-after($picsize,'width:'), ';')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> + <xsl:attribute name="fo:height"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="substring-after($picsize,'height:')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> <xsl:variable name="labelwidth"> <xsl:choose> <xsl:when test="w:pPr/w:ind/@w:hanging"> - <xsl:call-template name="convert2cm"> - <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'dxa')"/> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'twip')"/> </xsl:call-template> </xsl:when> <xsl:when test="w:pPr/w:ind/@w:first-line"> - <xsl:call-template name="convert2cm"> - <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'dxa')"/> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'twip')"/> </xsl:call-template> </xsl:when> <xsl:otherwise>0</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="leftwidth"> - <xsl:call-template name="convert2cm"> - <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'dxa')"/> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'twip')"/> </xsl:call-template> </xsl:variable> - <xsl:attribute name="text:space-before"><xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/></xsl:attribute> - <xsl:attribute name="text:min-label-width"><xsl:choose><xsl:when test="$labelwidth > 0"><xsl:value-of select="concat($labelwidth,'cm')"/></xsl:when><xsl:otherwise>0cm</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="text:space-before"> + <xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/> + </xsl:attribute> + <xsl:attribute name="text:min-label-width"> + <xsl:choose> + <xsl:when test="$labelwidth > 0"> + <xsl:value-of select="concat($labelwidth,'cm')"/> + </xsl:when> + <xsl:otherwise>0cm</xsl:otherwise> + </xsl:choose> + </xsl:attribute> <xsl:choose> <xsl:when test="w:suff/@w:val='Space'"> <xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute> </xsl:when> <xsl:when test="w:pPr/w:tabs/w:tab/@w:pos"> <xsl:variable name="tabpos"> - <xsl:call-template name="convert2cm"> - <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'dxa')"/> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'twip')"/> </xsl:call-template> </xsl:variable> <xsl:if test="number($tabpos) > (number($leftwidth)-number($labelwidth))"> - <xsl:attribute name="text:min-label-distance"><xsl:value-of select="concat(number($tabpos)+number($labelwidth)-number($leftwidth),'cm')"/></xsl:attribute> + <xsl:attribute name="text:min-label-distance"> + <xsl:value-of select="concat(number($tabpos)+number($labelwidth)-number($leftwidth),'cm')"/> + </xsl:attribute> </xsl:if> </xsl:when> </xsl:choose> </xsl:element> - <office:binary-data> - <xsl:value-of select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/w:binData"/> - </office:binary-data> </xsl:template> <!-- avoid listPr in textbox. :( glu --> <xsl:template match="w:p[w:pPr/w:listPr[w:ilvl and w:ilfo]]"> @@ -272,8 +366,16 @@ <xsl:variable name="firstoccur" select="/descendant::w:pPr[w:listPr/w:ilfo/@w:val = $currlistid][1]"/> <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/> <xsl:variable name="rootlistname" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]/w:listStyleLink/@w:val"/> - <xsl:element name="text:ordered-list"> - <xsl:attribute name="text:style-name"><xsl:choose><xsl:when test="string-length($rootlistname) > 0"><xsl:value-of select="$rootlistname"/></xsl:when><xsl:otherwise>List<xsl:value-of select="count($firstoccur/preceding::w:listPr)"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:element name="text:list"> + <xsl:attribute name="text:style-name"> + <xsl:choose> + <xsl:when test="string-length($rootlistname) > 0"> + <xsl:value-of select="$rootlistname"/> + </xsl:when> + <xsl:otherwise>List<xsl:value-of select="count($firstoccur/preceding::w:listPr)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> <xsl:choose> <xsl:when test="preceding::w:pPr/w:listPr/w:ilfo/@w:val = w:pPr/w:listPr/w:ilfo/@w:val"> <xsl:attribute name="text:continue-numbering">true</xsl:attribute> @@ -300,7 +402,7 @@ <xsl:call-template name="process-common-paragraph"/> </xsl:when> <xsl:otherwise> - <xsl:element name="text:ordered-list"> + <xsl:element name="text:list"> <xsl:element name="text:list-item"> <xsl:call-template name="levels"> <xsl:with-param name="level" select="$level -1"/> @@ -357,13 +459,15 @@ <xsl:param name="level"/> <xsl:element name="text:outline-level-style"> <xsl:choose> - <xsl:when test="w:style[@w:type = 'paragraph' and (w:pPr/w:outlineLvl/@w:val = $level -1) and w:pPr/w:listPr]"> + <xsl:when test="(w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl/@w:val = $level -1 and w:pPr/w:listPr ]/w:pPr/w:listPr)[position()=1]"> <xsl:apply-templates select="(w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl/@w:val = $level -1 and w:pPr/w:listPr ]/w:pPr/w:listPr)[position()=1]" mode="outline"> <xsl:with-param name="outlinelevel" select="$level"/> </xsl:apply-templates> </xsl:when> <xsl:otherwise> - <xsl:attribute name="text:level"><xsl:value-of select="$level"/></xsl:attribute> + <xsl:attribute name="text:level"> + <xsl:value-of select="$level"/> + </xsl:attribute> <xsl:attribute name="style:num-format"/> </xsl:otherwise> </xsl:choose> @@ -382,19 +486,26 @@ </xsl:variable> <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/> <xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/> - <xsl:for-each select="$rootlist/w:lvl[@w:ilvl=$currlistlevel]"> - <xsl:call-template name="list-styles-common"> - <xsl:with-param name="listtype"> - <xsl:choose> - <xsl:when test="w:nfc/@w:val"> - <xsl:value-of select="w:nfc/@w:val"/> - </xsl:when> - <xsl:otherwise>0</xsl:otherwise> - </xsl:choose> - </xsl:with-param> - <xsl:with-param name="currlevel" select="$outlinelevel"/> - </xsl:call-template> - </xsl:for-each> + <xsl:if test="$rootlist/w:lvl[@w:ilvl=$currlistlevel]"> + <xsl:for-each select="$rootlist/w:lvl[@w:ilvl=$currlistlevel]"> + <xsl:call-template name="list-styles-common"> + <xsl:with-param name="listtype"> + <xsl:choose> + <xsl:when test="w:nfc/@w:val"> + <xsl:value-of select="w:nfc/@w:val"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="currlevel" select="$outlinelevel"/> + </xsl:call-template> + </xsl:for-each> + </xsl:if> + <xsl:if test="not($rootlist/w:lvl[@w:ilvl=$currlistlevel])"> + <xsl:attribute name="text:level"> + <xsl:value-of select="'1'"/> + </xsl:attribute> + </xsl:if> </xsl:template> <xsl:template name="nfc2numformat"> <xsl:param name="nfcvalue"/> @@ -416,6 +527,65 @@ <xsl:when test="$nfcvalue=4"> <xsl:attribute name="style:num-format">a</xsl:attribute> </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:num-format">1</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="$nfcvalue=26"> + <xsl:attribute name="style:num-prefix"> + <xsl:value-of select="$prefix"/> + </xsl:attribute> + <xsl:attribute name="style:num-suffix"> + <xsl:value-of select="concat( '.' , $suffix )"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=27 or $nfcvalue=29"> + <xsl:attribute name="style:num-prefix"> + <xsl:value-of select="concat( $prefix, '(' )"/> + </xsl:attribute> + <xsl:attribute name="style:num-suffix"> + <xsl:value-of select="concat( ')' , $suffix )"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=57"> + <xsl:attribute name="style:num-prefix"> + <xsl:value-of select="concat( $prefix, '- ' )"/> + </xsl:attribute> + <xsl:attribute name="style:num-suffix"> + <xsl:value-of select="concat( ' -' , $suffix )"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:num-prefix"> + <xsl:value-of select="$prefix"/> + </xsl:attribute> + <xsl:attribute name="style:num-suffix"> + <xsl:value-of select="$suffix"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- xsl:template name="nfc2numformat"> + <xsl:param name="nfcvalue"/> + <xsl:param name="prefix"/> + <xsl:param name="suffix"/> + <xsl:choose> + <xsl:when test="$nfcvalue=0"> + <xsl:attribute name="style:num-format">1</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=1"> + <xsl:attribute name="style:num-format">I</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=2"> + <xsl:attribute name="style:num-format">i</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=3"> + <xsl:attribute name="style:num-format">A</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=4"> + <xsl:attribute name="style:num-format">a</xsl:attribute> + </xsl:when> <xsl:when test="$nfcvalue=10 or $nfcvalue=11 or $nfcvalue=17 or $nfcvalue=29 or $nfcvalue=33 or $nfcvalue=35 or $nfcvalue=36 or $nfcvalue=37 or $nfcvalue=39 or $nfcvalue=44"> <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute> </xsl:when> @@ -495,5 +665,5 @@ <xsl:attribute name="style:num-suffix"><xsl:value-of select="$suffix"/></xsl:attribute> </xsl:otherwise> </xsl:choose> - </xsl:template> + </xsl:template --> </xsl:stylesheet> |