[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Tricky transformation task


Subject: Re: [xsl] Tricky transformation task
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 12 Jul 2007 00:43:43 +0100

> - My xml's sometimes have more than a few thousand <LINK> tags and after 
> some magical threshold (a few hundred) the stylesheet throws the 
> following error:
>    "Too many nested apply-templates calls. The stylesheet may be
> looping"

ho hum, check you have the latest version of saxon (MK keeps fine tuning
his tail recursion elimination) failing that it's probably possible to
write it to pass the lists as a parameter sequence rather than iterating
along the sibling axis, but not at this time of night:-)

> - I forgot to mention that the SUBG-ID which I have to assign has to be 
> numeric, 

just replace generate-id() with something else (eg an integer parametr
 that you pass along and increment each time you allocate a new id)
or in the final end template,  group on the generated id using for-each-group and
 replacing the id with position() which numbers the groups in that
 context.

> - I have to admit I didn't really get this one part of your stylesheet. 
> What exactly are you doing here? After the ITEM (L) has been added and 
> you checked that O1 and O2 are already present, nothing else has to be 
> added, right?
> <xsl:with-param name="r"
> select="$r/d:join(.,current()/@O1-ID,current()/@O2-ID),$L"/>

If the link that's just about to be added joins two components that were
previously disconnected, and so have been allocated different subgraph
ids, you need to merge them into one subgraph by changing all teh ids of
teh second component to be the id of the first.

David









________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________


Current Thread
Keywords