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

XSLT 2.0 & Grouping

Subject: XSLT 2.0 & Grouping
From: Mark Brand <mark.brand@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 06 Aug 2003 02:11:26 +1000
mark brand
Hi all

I am having some issues with understanding the for-each-group mechanism in XSLT 2.0
and how I can apply it to my particular situation. Michael Kay yesterday pointed me at some positional grouping information which may appear to offer a solution. But i can't get my head around how to manage the nesting aspects. That is having to output
an opening <PART> tag and then managing all the child tags and then
coming back somehow to put in the closing </PART> tag. I am using XSLT 2.0 Saxon 7.5 and I would really like some help on this - as I am a bit stuck.


===Problem Context =============================================
I need to iterate through each paragraph in the Source XML document (below)
and depending on what the paragraph style is i need to output
some markup & content whilst keeping the nesting (PARTS, contain DIVISIONS,
contain SUBDIVISIONS contain REGULATIONS contain SUB-REGULATIONS etc.) intact


=== Source XML Document ========================================
<Document>
   <Paragraph StyleName="PART">..................</Paragraph>
   <Paragraph StyleName="DIVISION">..............</Paragraph>
   <Paragraph StyleName="SUBDIVISION">...........</Paragraph>
   <Paragraph StyleName="REGULATION">............</Paragraph>
   <Paragraph StyleName="SUB-REGULATION">........</Paragraph>
   <Paragraph StyleName="PARAGRAPH">.............</Paragraph>
   <Paragraph StyleName="SUB-PARAGRAPH">.........</Paragraph>
   <Paragraph StyleName="SUB-PARAGRAPH">.........</Paragraph>
   <Paragraph StyleName="SUB-SUB-PARAGRAPH">.....</Paragraph>
   <Paragraph StyleName="SUB-SUB-PARAGRAPH">.....</Paragraph>
   <Paragraph StyleName="SUB-PARAGRAPH">.........</Paragraph>
   <Paragraph StyleName="SUB-PARAGRAPH">.........</Paragraph>
   <Paragraph StyleName="SUB-SUB-PARAGRAPH">.....</Paragraph>
   <Paragraph StyleName="SUB-SUB-PARAGRAPH">.....</Paragraph>
   <Paragraph StyleName="PARAGRAPH">.............</Paragraph>
   <Paragraph StyleName="SUB-PARAGRAPH">.........</Paragraph>
   <Paragraph StyleName="SUB-SUB-PARAGRAPH">.....</Paragraph>
   <Paragraph StyleName="SUB-SUB-PARAGRAPH">.....</Paragraph>
   <Paragraph StyleName="SUB-PARAGRAPH">.........</Paragraph>
   <Paragraph StyleName="SUB-PARAGRAPH">.........</Paragraph>
   <Paragraph StyleName="SUB-SUB-PARAGRAPH">.....</Paragraph>
   <Paragraph StyleName="SUB-SUB-PARAGRAPH">.....</Paragraph>
   <Paragraph StyleName="SUB-SUB-PARAGRAPH">.....</Paragraph>
   <Paragraph StyleName="SUB-PARAGRAPH">.........</Paragraph>
   <Paragraph StyleName="SUB-REGULATION">........</Paragraph>
   <Paragraph StyleName="SUB-REGULATION">........</Paragraph>
   <Paragraph StyleName="SUB-REGULATION">........</Paragraph>
   <Paragraph StyleName="SUB-REGULATION">........</Paragraph>
   <Paragraph StyleName="NOTE">..................</Paragraph>
</Document>

=== Required Output ======================
<Regulation>
   <Part Category="PART">
       <Part Category = "DIVISION">
           <Part Category = "SUBDIVISION">
               <Article>
                   <Sub-Article>
                       <Paragraph>
                           <Sub-Paragraph/>
                           <Sub-Paragraph>
                               <Sub-Sub-Paragraph>
                               <Sub-Sub-Paragraph>
                           <Sub-Paragraph/>
                           <Sub-Paragraph/>
                           <Sub-Paragraph>
                               <Sub-Sub-Paragraph/>
                               <Sub-Sub-Paragraph/>
                           </Sub-Paragraph>
                       </Paragraph>
                   </Sub-Article>
              </Article>
           </Part>
       </Part>
   </Part>
</Regulation>


Best Regards & Thanks Mark Brand



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


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.