How would you add depth to this flat XML source?

Subject: How would you add depth to this flat XML source?
From: "Eric G. Bosch" <eric@xxxxxxxxxxx>
Date: Thu, 25 May 2000 14:39:51 -0400 (EDT)
I am trying to convert a flat XML document with this structure:

<firstitem>Item 1</firstitem>
<item>Second Text</item>
<item>blah blah</item>
<item>tee hee</item>
<firstitem>List 2, Item 1</firstitem>
<item>more text</item>
<firstitem>more lists</firstitem>
<item>test</item>

into something like this (indenting is purely decorative):

<list>
	<item>Item 1</item>
	<item>Second Text</item>
	<item>blah blah</item>
	<item>tee hee</item>
</list>
<list>
	<item>List 2, Item 1</item>
	<item>more text</item>
</list>
<list>
	<item>more lists</item>
	<item>test</item>
</list>

It seems to me that I can process each <firstitem> element and then apply 
templates to all of the following-siblings that have their first <firstitem> 
preceding-sibling equal to the current <firstitem>.  But, a) I can't seem to get 
the syntax right for this solution, b) this seems like an odd way to solve the 
problem, and c) somebody probably knows an easier way.

Thanks in advance for any suggestions... 

----------
Eric Bosch
Clinical DataFax Systems Inc.
Voice: 905.522.3282.x223
Fax:   905.522.7284
Email: eric@xxxxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread