Processing Select Patterns in XSL...
tyler at infinet.com
Thu Sep 17 07:46:19 BST 1998
One thing that is slightly confusing with select patterns is selecting
elements containing parent anchors.
For example, say I have:
>From what I understand, this would say first go to the third parent node
of the current node and select all heading elements and process them.
This would seem to be an error since another template may already have
processed these heading elements.
Match patterns seem to be pretty straightforward in how you use them as
all you need to really do is start at the right-most pattern component
and work left. If everything matches up then finally make sure that the
anchor matches up with the parent of the node that matched the left most
pattern. If everything still holds, then apply the template rule to
this particular element in the source tree when spitting out the result
Now select patterns it seems from first glance that you would instead
start from the current node and work left to right instead of right to
left as in the case of match patterns. Essentially, you would start
from the current node and recursively process all of the descendants
that end up matching the ancestry pattern from left to right. For
ancestry patterns that do not contain an immediate ancestor operator
this process would be rather cheap.
But in the above example, what do you do when relative or absolute
anchors withing select patterns anchor a node which is an ancestor of
the current node in context. In this case, it seems as if you can have
multiple template rules acting on the same elements.
Another question is what to do with Absolute Anchors. I would think
that for select patterns it would not make sense for this to be allowed
as the entire template match then has nothing to do with the actual
processing. For example if I match a particular element and then select
a set of nodes who are anchored at the root, this would be like doing
global processing independent of the match argument.
I am sure many of these questions are things which I do not understand
due to my relative inexperience with stylesheet languages (most people
are probably also in this boat) and the fact that the most recent spec
is very much incomplete, but it would be nice to know if these are
errors overlooked in the spec, or just my complete misunderstandings on
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev