|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XPath for matching multiple child elements
> Probably this would be faster? > > <xsl:stylesheet version="2.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > > > <xsl:key name="kComDesc" match="h1|p|b|i" > use="exists(ancestor::Comments[1])"/> > > <xsl:template match="key('kComDesc', 'true')"> > Whatever processing here > </xsl:template> > </xsl:stylesheet> Yes, that would probably work reasonably well (and it's nice to find a plausible use case for using key() in a pattern). One point to be careful about though: if the "use" value is a boolean, the second parameter of key() should also be a boolean, so it should be key('kComDesc', true()). There's no implicit casting in 2.0, and non-comparable values are treated as not matching, so you can get some hard-to-diagnose errors in this area. The "[1]" suggests you don't have much confidence in your product's optimizer... Michael Kay http://www.saxonica.com/
|
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
|






