Subject: RE: [xsl] Searching for elements in XML From: "Michael Kay" <mhk@xxxxxxxxx> Date: Sun, 4 Jul 2004 18:10:43 +0100 |
> -----Original Message----- > From: Nestor Boscan [mailto:nestor.boscan@xxxxxxxxxx] > Sent: 04 July 2004 01:31 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] Searching for elements in XML > > Hi > > In terms of performance which is better As with all performance questions, it depends on the product you are using, and the only way to find out is by measurement. Saxon rewrites "//a|//b|//c" as "/descendant::*[self::a or self::b or self::c]" which means it finds all the required elements in a single scan of the tree with no sorting. So this will probably be faster than three separate xsl:for-each instructions which scan the tree three times. But other products may differ. Michael Kay if I'm searching for > a number of > elements in the XML file and I don't care about the order: > > Let's say I'm searching for elements a, b and c: > > <xsl:for-each select="//a|//b|//c"> > </xsl:for-each> > > or > > <xsl:for-each select="//a"> > </xsl:for-each> > > <xsl:for-each select="//b"> > </xsl:for-each> > > <xsl:for-each select="//c"> > </xsl:for-each> > > or is there a better way? > > Thanks in advance > > Regards, > > Néstor Boscán > > > > --+------------------------------------------------------------------ > 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@xxxxxxxxxxxxxxxxxxxxxx> > --+-- > >
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Searching for elements in, Niclas Hedhman | Thread | XForms and browsers, Roger |
Re: [xsl] Searching for elements in, Niclas Hedhman | Date | XForms and browsers, Roger |
Month |