xsl-list
[Top] [All Lists]

RE: Searching for elements in XML

2004-07-04 10:10:43
 

-----Original Message-----
From: Nestor Boscan [mailto:nestor(_dot_)boscan(_at_)tcs(_dot_)com(_dot_)ve] 
Sent: 04 July 2004 01:31
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--





<Prev in Thread] Current Thread [Next in Thread>