[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSLT 2.0 & Grouping
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>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|