[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: How to efficiently remove "a" nodes with no "b" de
> If I say > > > <xsl:template match="a[not(.//b)]"/> > > then all the descendants of "a" are checked for "b" elements. Let's > have a closer look at the input structure. > This presupposes that the XSLT processor you are using does > no optimisation, which may or may not be true. > Optimizers look for "quick wins", constructs that are used sufficiently often to be worth treating specially, and I suspect this isn't one of them. Generally, it's bad news to put a complex test like this into a match pattern, because there is little alternative to testing each node selected by <apply-templates> against this pattern; there is more scope to optimise a node-set expression than a pattern. You might find that a more efficient approach is <xsl:variable name="ancestors-of-b" select="//b/ancestor::*"/> <xsl:variable name="anc-of-b-count" select="count($ancestors-of-b)" <xsl:template match="a"> <xsl:if test="count(.|ancestors-of-b) != $anc-of-b-count"> ... Mike Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|