[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Tempore 07:26:48, die 02/16/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Vasu Nanjangud <vasdeep@xxxxxxxxx>:
Here is a stylesheet that will do the rudimentary operations to ouput an html lists up to arbitrary level. No distinction is made between numbering forms; I don't feel like unraffling the meaning those list definition elements.;)
I you want to include different numbering styles, I advise you to use 'style' attributes and let the XSLT build a css section in your html that will take care of the styling.
<xsl:key name="list" match="w:listPr" use="generate-id(ancestor::w:p/preceding-sibling::w:p/w:pPr/w:listPr[number(current()/w:ilvl/@w:val) - number(w:ilvl/@w:val)=1])"/>
<xsl:template match="w:listPr" mode="styling">
<li>
<xsl:apply-templates select="../../w:r" mode="styling"/>
<xsl:if test="key('list',generate-id())">
<ol>
<xsl:apply-templates select="key('list',generate-id())" mode="styling"/>
</ol>
</xsl:if>
</li>
</xsl:template>
</xsl:stylesheet>
Btw, you should not have included entire files; snippets would have been OK.
regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
"CB&CB9CB;CB.CB:CB?CB?CB= CB5CB9CB=CB1CB9 CB<CB1CB;CB;CB?CB= CB7 Cb CB9CB;CECB;CB1CB;CB?CB=" - CE!CB;CB5CECB2CB?Cb&CB;CB?Cb
Re: Fwd: Re: [xsl] WordML to XML
Subject: Re: Fwd: Re: [xsl] WordML to XML From: "Joris Gillis" <roac@xxxxxxxxxx> Date: Thu, 17 Feb 2005 18:27:09 +0100 |
Tempore 07:26:48, die 02/16/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Vasu Nanjangud <vasdeep@xxxxxxxxx>:
Hi,Please take a look at it and let me know how the 'listPr' tags be converted to give meaningful xml data like <ol> <li>Alpha</li> <li>Beta</li> <li>Gamma</li> </ol>
and other cases like a,b,c or 1,2,3,4.
Here is a stylesheet that will do the rudimentary operations to ouput an html lists up to arbitrary level. No distinction is made between numbering forms; I don't feel like unraffling the meaning those list definition elements.;)
I you want to include different numbering styles, I advise you to use 'style' attributes and let the XSLT build a css section in your html that will take care of the styling.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" exclude-result-prefixes="w"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:key name="list" match="w:listPr" use="generate-id(ancestor::w:p/preceding-sibling::w:p/w:pPr/w:listPr[number(current()/w:ilvl/@w:val) - number(w:ilvl/@w:val)=1])"/>
<xsl:template match="*[w:p/w:pPr/w:listPr]"> <ol> <xsl:apply-templates select="w:p[w:pPr/w:listPr/w:ilvl/@w:val='0']"/> </ol> </xsl:template>
<xsl:template match="w:p"> <xsl:apply-templates select="(w:pPr|w:r)[1]" mode="styling"/> </xsl:template>
<xsl:template match="w:pPr" mode="styling"> <xsl:apply-templates select="w:listPr" mode="styling"/> </xsl:template>
<xsl:template match="w:listPr" mode="styling">
<li>
<xsl:apply-templates select="../../w:r" mode="styling"/>
<xsl:if test="key('list',generate-id())">
<ol>
<xsl:apply-templates select="key('list',generate-id())" mode="styling"/>
</ol>
</xsl:if>
</li>
</xsl:template>
</xsl:stylesheet>
Btw, you should not have included entire files; snippets would have been OK.
regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
"CB&CB9CB;CB.CB:CB?CB?CB= CB5CB9CB=CB1CB9 CB<CB1CB;CB;CB?CB= CB7 Cb CB9CB;CECB;CB1CB;CB?CB=" - CE!CB;CB5CECB2CB?Cb&CB;CB?Cb
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Fwd: Re: [xsl] WordML to XML, Vasu Nanjangud | Thread | [xsl] Introduction of Mine, Dhiraviyam K. |
Re: [xsl] FOP, Help fo:page-number, JBryant | Date | Re: [xsl] Javascript variable to XS, Camaleón |
Month |