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

RE: Converting WordML to a XHTML list

Subject: RE: Converting WordML to a XHTML list
From: "Lincoln Mitchell" <lincoln@xxxxxxxxxxx>
Date: Sat, 28 Aug 2004 05:43:47 +0800
wordml to xhtml
Worked a charm, Thx heaps mate!

Linc 

-----Original Message-----
From: cking [mailto:cking@xxxxxxxxxx] 
Sent: Thursday, 26 August 2004 6:03 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Converting WordML to a XHTML list

Hi Lincoln,

Here's a possible solution, using recursion: 

<xsl:template match="w:p">
    <xsl:choose>
        <xsl:when test="w:pPr/w:listPr">
            <xsl:if test="not(preceding-sibling::w:p[1]/w:pPr/w:listPr)">
                <xsl:apply-templates select="w:r/w:t" mode="list-begin"/>
            </xsl:if>
        </xsl:when>
        <xsl:when test="w:pPr/w:pStyle/@w:val='Heading5'">
            <h2><xsl:value-of select="w:r/w:t"/></h2>
        </xsl:when>
        ....
        <xsl:otherwise>
            <p><xsl:value-of select="w:r/w:t"/></p>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

<xsl:template match="w:t" mode="list-begin">
    <ol>
        <xsl:apply-templates select="." mode="list-item-recursive"/>
    </ol>
</xsl:template>

<xsl:template match="w:t" mode="list-item-recursive">
    <li><xsl:value-of select="."/></li>
    <xsl:variable name="next" select="../../following-sibling::w:p[1]"/>
    <xsl:if test="$next/w:pPr/w:listPr">
        <xsl:apply-templates select="$next/w:r/w:t"
mode="list-item-recursive"/>
    </xsl:if>
</xsl:template>

I hope this can clear up the mud? :)
Anton Triest

Wednesday, August 25, 2004 3:41 PM, Lincoln Mitchell wrote:
>
> I can see where you are going but a list of items maybe in other 
> locations in the wordml so "//w:t[../../w:pPr/w:listPr]" will match them
too.
> 
> However as list items will be in one block, maybe we create a rule 
> like
> this:
> 1. For 1st "w:p/w:pPr/w:listPr" create "<OL>" and "<li>...</li>"
> 2. While "following-sibling" = "w:p/w:pPr/w:listPr" do "<li>...</li>"
> 3. </OL>
> 
> Clear as mud?
> 
> 
> If no resolve this time round I will send complete xsl and xml.
> 
> Linc

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.