xsl-list
[Top] [All Lists]

RE: [xsl] Flat XML to hierarchical output ...

2007-08-20 15:43:55
Search for "XSLT positional grouping".

In XSLT 2.0, use <xsl:for-each-group group-starting-with="HEADER">

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: Tim Dexter [mailto:timothy(_dot_)dexter(_at_)gmail(_dot_)com] 
Sent: 20 August 2007 23:36
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Flat XML to hierarchical output ...

Hi All

I have the following data structure

<REPORT>
 <HEADER>
  ...
 </HEADER>
 <LINE>
  ...
 </LINE>
 <TOTAL>
  ...
 </TOTAL>
 <HEADER>
  ...
 </HEADER>
 <LINE>
  ...
 </LINE>
 <TOTAL>
  ...
 </TOTAL>
 <HEADER>
  ...
 </HEADER>
 <LINE>
  ...
 </LINE>
 <LINE>
  ...
 </LINE>
 <LINE>
  ...
 </LINE>
 <TOTAL>
  ...
 </TOTAL>
</REPORT>

 Although the XML is not hierarchical there is a hierarchy 
required in output ie HEADER  LINES TOTAL

the only thing that is guaranteed is that the data is in 
sequential hierarchy order ie HEADER is followed by LINES by 
TOTAL. Notice that there maybe 1 or more instances of LINE 
following HEADER ie multi lines for a given header.

I have tried loading the HEADER-LINE-TOTAL trees into 
variables, then looping thru the HEADER and grabbing LINE and 
TOTAL values based on the HEADER record position(). Of course 
a ll is fine until I hit a HEADER with multiple lines.

I'm still trying this but if anyone has come across and 
solved a similar problem I'd greatly appreciate any input

Thanks

tim

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>