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

Changing a Tree Walking, forward walk example

Subject: Changing a Tree Walking, forward walk example
From: "Graeme Kidd" <coolkidd3@xxxxxxxxxxx>
Date: Sat, 24 Jan 2009 01:04:22 -0000
 Changing a Tree Walking
Hi everyone,

I am having trouble converting this Tree Walking, forward walk example :
http://www.dpawson.co.uk/xsl/sect2/N4486.html#d6060e1105

Into something more related to my problem and I am using XSLT 2.0.
The example in mention will convert this:

<document>
 <para>First para</para>
 <change-start id="c1"/>
 <para>Second para</para>
 <para>Third para</para>
 <change-start id="c2"/>
 <para>Fourth para</para>
 <change-end id="c2"/>
 <para>Fifth para</para>
 <change-end id="c1"/>
 <para>Sixth para</para>
</document>

To this:

<document>
 <para>First para</para>
 <ins id="c1">
   <para>Second para</para>
   <para>Third para</para>
   <ins id="c2">
     <para>Fourth para</para>
   </ins>
   <para>Fifth para</para>
 </ins>
 <para>Sixth para</para>
</document>

The problem is that my list does not have an end list node if a new list starts immediately after an existing list. So for example this:
<document>
<p>Non List text</p>
<list>List Heading Type 1</list>
<p>First item</p>
<p>Second item</p>
<list>List Heading Type 2</list>
<p>First item</p>
<p>Second item</p>
<p>Third item</p>
<list>End List</list>
<p>Unrelated Text</p>
<p>Not in a list</p>
<list>List Heading Type 1</list>
<p>First item</p>
<list>End List</list>
<p>More Unrelated Text</p>
<p>Not in a list</p>
</document>


Needs to be changed to this:

<document>
   <p>Non List text</p>
   <list>
       <li>First item</li>
       <li>Second item</li>
   </list>
   <list>
       <li>First item</li>
       <li>Second item</li>
       <li>Third item</li>
   </list>
   <p>Unrelated Text</p>
   <p>Not in a list</p>
   <list>
       <li>First item</li>
       <li>Second item</li>
   </list>
   <p>More Unrelated Text</p>
   <p>Not in a list</p>
</document>

I am finding it hard because I need to match a list node that does not contain "End List" to start a list as well as end it. So far I have not been able to detect if I am still in a list before a new list starts, in which case I need to close it and start a new one.

Thanks in advance for any help on this.

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.