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

Re: [xsl] "Tunneling" a parameter in document order

Subject: Re: [xsl] "Tunneling" a parameter in document order
From: "Christopher R. Maden" <crism@xxxxxxxxx>
Date: Fri, 13 Apr 2012 11:58:44 -0400

Hash: SHA1

On 04/13/2012 04:31 AM, Christian Roth wrote:
> that's why I did not give an example in the first place :-) A simpler
> example, unfortunately, would not be "covering the various
> possibilities".
> As for the basic requirement, I tried to describe it with: "Keeping a
> global variable's value current while doing a depth-first traversal
> of a document, where the variable's value is not scoped by either the
> document's element hierarchy, nor the nesting of XSLT template
> calls."
> I'll try in a different way: Imagine someone has laid a rope along
> the path of a depth-first traversal of the document tree. The initial
> color of the rope is red. However, any node in the tree may decide to
> change its color (e.g. to green), which the rope then has from the
> start of that node on for all later (=following::) ones until we
> reach the document end, or up to the next node that chooses to change
> the rope's color again. All nodes along the path can query the rope's
> color (that's the parameter I need to 'tunnel' through the document
> in document order) it has when it reaches them.
> Which new color a node changes the rope's color to depends on its
> context and(!) the current color of the rope it has when it reaches
> it.

This sounds very similar to the problem I was trying to solve last week;
I ended up just implementing a manual traversal of the nodes, keeping
some state around.  Not a very XSLTish solution, but it was the best I
could come up with.  Check the archives.

- --
Chris Maden, text nerd  <URL: http://crism.maden.org/ >
bBe wary of great leaders.  Hope that there are many, many small
 leaders.b b Pete Seeger
GnuPG fingerprint: DB08 CF6C 2583 7F55 3BE9  A210 4A51 DBAC 5C5C 3D5E
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


Current Thread