[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
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
|