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

RE: XSL Positional Grouping Problem

Subject: RE: XSL Positional Grouping Problem
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 27 May 2005 09:19:38 +0100
luke mclean
You can compute the level number of a <Data> element using

count(../preceding-sibling::Cell)+1

You've then got a problem that's essentially the same as the one which I
solve at:

http://www.idealliance.org/proceedings/xml04/papers/111/mhk-paper.html

using a recursive application of xsl:for-each-group

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

> -----Original Message-----
> From: Luke McLean [mailto:Luke.McLean@xxxxxxxxxxxxx] 
> Sent: 26 May 2005 21:59
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  XSL Positional Grouping Problem
> 
> Hello, I'm hoping that someone can point me in the right direction. I
> have the following need:
> 
> I have been sent an MS Excel file that I have been asked to transform
> in the following way...
> 
> <Table>
> <Row>
> <Cell><Data>Level 1</Data></Cell>
> <Cell/>
> <Cell/>
> <Cell/>
> </Row>
> <Row>
> <Cell/>
> <Cell><Data>Level 2</Data></Cell>
> <Cell/>
> <Cell/>
> </Row>
> <Row>
> <Cell/>
> <Cell><Data>Level 2</Data></Cell>
> <Cell/>
> <Cell/>
> </Row>
> <Row>
> <Cell/>
> <Cell/>
> <Cell><Data>Level 3</Data></Cell>
> <Cell/>
> </Row>
> <Row>
> <Cell/>
> <Cell><Data>Level 2</Data></Cell>
> <Cell/>
> <Cell/>
> </Row>
> ..+5000 Rows
> 
> </Table
> 
> To a nested structure which is based on the position of the <Data>
> tag.
> 
> 
> <Table>
> <Level><Data>Level 1</Data>
>     <Level><Data>Level 2</Data</Level>
>     <Level><Data>Level 2</Data
>         <Level><Data>Level 3</Data</Level>
>     </Level>
>     <Level><Data>Level 2</Data</Level>
> 
> ..etc
> 
> </Level>
> </Table>
> 
> The nesting goes both up and down levels so I'm assuming recusion is
> the way to go but the level of existing nesting has me wracking my
> brains (when you don't do much of this it is a daunting task...). 
> 
> Thanks in advance,
> 
> Luke.
> 
> 
> 
> ##############################################################
> #######################
> This e-mail message has been scanned for Viruses and Content 
> and cleared 
> by NetIQ MailMarshal
> ##############################################################
> #######################
> 
> ##############################################################
> ##########
> This email message and any attachment(s) is intended solely for the
> addressee(s) named above. The information it contains is confidential
> and may be legally privileged.  Unauthorised use of the message, or
> the information it contains, may be unlawful. If you have received
> this message by mistake please call the sender immediately on
> 64 4 463 2500 or notify us by return email and erase the original
> message and attachments. Thank you.
> 
> The New Zealand Food Safety Authority of MAF accepts no responsibility
> for changes made to this email or to any attachments after 
> transmission
> from the office.
> ##############################################################
> ##########

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.