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

Re: Creating a complex hierarchical structure from fla

Subject: Re: Creating a complex hierarchical structure from flat strcuture
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 16 Mar 2007 13:53:18 GMT
Re:  Creating a complex hierarchical structure from fla
> However, i'm not sure upto what level my hierarchy is there a more 
> general or better way to do this?

it's a bit tricky (perhaps) to be fully general as both your input and
output is using the more rigid form with level-specific names like
subsection2para (on input) and subsection2 (on output). rather than just
using generic names and letting the level being implied by the hierarchy
(which typically makes it easier to share code between levels).

Hoewever if that's the way the elemnt names have to be, so be it.

I would work in two stages, first remove the hard coded element names
by some code that generates them based on a level parameter, ie replace


  <subsection2>
  <xsl:for-each-group  select="current-group()"
... (@class, 'subsection[3]para', 

by

<xsl:variable name="l" select="2"/>
  <xsl:element name="subsection{$l}">
  <xsl:for-each-group  select="current-group()"
... (@class, concat('subsection[',$l+1,']para'), 

...

then once that's working, you may well find that the code you have for
each level can be placed in a template with a l parameter that can just
call itself wil l set to $l+1 if there are any non-empty groups to
process, which would alow you to refactor and share the code for each
group level.


David

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.