From: "Xavier Boully" <xavier(_dot_)boully(_at_)ultra-fluide(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: [xsl] recursivity and param
Date: Thu, 12 Aug 2004 12:32:35 +0200
I would like to use recursivity through the source document with XSLT 1.0
and no extension.
As far as I understood, when I am at a node level, I have a context that I
can pass to children level using with-param.
But what I would like to obtain is to catch things from children treatment
to influence the context of the node level: when I pass context to a
certain
child I would like to take in account things that happened before while
processing children I met before (in order of source document for example).
Reading again that question make me think that it is maybe not clear
enough.
Let's try an example.
- Suppose that in source tree we have some <to-copy-element /> elements
- Suppose that I just want my XSLTransformation to copy to the result tree
the <to-copy-element /> from the source tree.
- Suppose that I add a condition that I must not copy more than 10
<to-copy-element />. In other words I want to copy only the first (in order
of source document) 10 <to-copy-element /> elements or all the
<to-copy-element /> elements if count(//to-copy-element)<11.
I think (but this is maybe a wrong hypothesis) that at a given node level,
I
have to pass to a child information about the number of copies done with
children processed before.
Any ideas ?
Xavier
Is there any reason you can't select using a position predicate?
xsl:apply-templates select="to-copy-elements[position() < 11]"...
--
Joe