xsl-list
[Top] [All Lists]

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

2012-04-13 11:01:05
-----BEGIN PGP SIGNED MESSAGE-----
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
- -- 
Chris Maden, text nerd  <URL: http://crism.maden.org/ >
“Be wary of great leaders.  Hope that there are many, many small
 leaders.” — Pete Seeger
GnuPG fingerprint: DB08 CF6C 2583 7F55 3BE9  A210 4A51 DBAC 5C5C 3D5E
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPiE00AAoJEEpR26xcXD1eASQH/3y9wsX15Gq1Bf6h/AmFBKe7
J2/IY+BtGTTDOnd6CSlYFTqcDN1pso8zGWZPZ54N6rdw9X875IaqsoCAiz0ewJk9
MLvtlm7mtXu2tA4vBtj38vNxeTRRakYXlrOKP7j/FGB6U3ey9IZsYFkwD20O1hPS
KX4Sv4Y7yPiHy9recB5oUmV7dJtKiYT/cirZoFuRAcL7crG4m3GZ4hRhQXC4GDGf
PDHvzhlfNKKjvo55UOS1X8Rq10I43NPsIbqmoaib1jPgL2K9ppW73/Pnez5Ymr1t
OExD/JflLHVhGdRzHxffYJiB4HV4b6ylbwGriOXJw991TmC4mOOuUfug6ENpcSM=
=hw5H
-----END PGP SIGNATURE-----

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--