[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Fwd: Re: WordML to XML

Subject: Re: Fwd: Re: WordML to XML
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Thu, 17 Feb 2005 18:27:09 +0100
w listpr
Tempore 07:26:48, die 02/16/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Vasu Nanjangud <vasdeep@xxxxxxxxx>:

  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.

Hi,

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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.