xsl-list
[Top] [All Lists]

Re: Simple list -> Nested list based on attribute values

2004-08-19 10:07:22
this faq page should help.
http://www.dpawson.co.uk/xsl/sect2/flatfile.html#d4548e117

Josh

On Thu, 19 Aug 2004 18:48:42 +0200, jhaines(_at_)maninvestments(_dot_)com
<jhaines(_at_)maninvestments(_dot_)com> wrote:
I have an XML document of the form

<doc>
 <item header='true'>Section 1</item>
 <item>Section 1.1</item>
 <item>Section 1.2</item>

 <item header='true'>Section 2</item>
 <item>Section 2.1</item>
 <item>Section 2.2</item>
</doc>

that I want to transform to the following:

<doc>
 <section title="Section 1">
   <item>Section 1.1</item>
   <item>Section 1.2</item>
 </section>

 <section title="Section 2">
   <item>Section 2.1</item>
   <item>Section 2.2</item>
 </section>
</doc>

I was able to match the @header <item>s with the rule 'item[(_at_)header =
"true"]' but couldn't work out a predicate to match "all subsequent
<item>s up until the next @header <item>".

Jason

Any information in this communication is confidential and may be privileged 
or otherwise protected from disclosure without our consent. If you are not 
the intended recipient, you are not authorised to and must not disclose, 
copy, distribute, or retain this message or any part of it. You are requested 
to please telephone or email the sender and delete this message and any 
attachment from your system.

Due to the electronic nature of e-mail, there is a risk that the information 
contained in this message has been modified. Consequently we can accept no 
responsibility or liability as to the completeness or accuracy of the 
information.

A-03-03-E

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--