[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Searching for elements in XML

Subject: RE: Searching for elements in XML
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sun, 4 Jul 2004 18:10:43 +0100
xsl searching
 

> -----Original Message-----
> From: Nestor Boscan [mailto:nestor.boscan@xxxxxxxxxx] 
> Sent: 04 July 2004 01:31
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.