RE: [xsl] XPath for matching multiple child elements

Subject: RE: [xsl] XPath for matching multiple child elements
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 29 Sep 2006 17:39:31 +0100
> On the other hand, I'm not sure pipelining in itself is any more (or
> less) "natural" than template matching; 

Yes, but the point about maintainability isn't that the design is
necessarily easier to establish in the first place, it's that it's open to
change and resistant to structural decay once in place. In particular, new
functionality can often be introduced by adding a pipeline component, which
means there is minimal need to understand the internal logic of existing
components, and minimal risk of destabilizing them.

The pipeline I use internally in the Saxon serializer has been a great
success from that point of view. Spec changes like doing URL escaping before
rather than after character substitution would have been a nightmare with a
monolithic approach; as it is, they just involve a small change to the
component that assembles the pipeline. And although there's an overhead in
passing every node through a pipeline of a dozen processing steps, many of
which might pass it through unchanged, this is offset by the fact that the
pipeline is configurable to only apply those processes that are actually
needed, so a conditional like "if XML 1.1" or "if normalizing" is only being
applied once at pipeline-configuration time, rather than once for each node
(or in the worst case, each character!) processed.

Michael Kay

Current Thread