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

Re: Effecient element "filtering" technique recommenda

Subject: Re: Effecient element "filtering" technique recommendations.
From: Trevor Nash <tcn@xxxxxxxxxxxxx>
Date: Wed, 09 Oct 2002 18:36:52 +0100
element filter
On Mon, 07 Oct 2002 08:15:41 -0600, Ed Knoll wrote:

>I'm looking for recommendations on ways in which we can only process the
>row columns which correspond to the other columns.  My current approach
>is adding approximately 40% onto our total XSL processing time.

The fastest ay to do this is via a SAX filter.  Then the XSLT doesn't
even see the nodes it doesn't need.  It is also realtively hard to
implement, so it depends how important performance is.

On your supplied code:

 >XML::
>
><Table>
>  <Columns>
>    <Column1/>
I would try <Column>Column1</Column> here.  
> ...

>
>XSL (fragments) w/ filtering::
>
><xsl:variable name="TableColumns" select="/Table/Columns/*" />

Then:
  <xsl:variable name="TableColumns" select="/Table/Columns/*/node()"/>
i.e. a list of text nodes with the element names required.

>
><xsl:template  select="/Table/Row">
You might as well say just "Row" here.  You are asking the processor
to check that the Row element is the child of a Table which is the
document element.  If this is always true there is no point checking
it.

>   <xsl:for-each select="*">
>      <xsl:variable name="MyName" select="name()" />
>      <xsl:if test="$TableColumns[name()=$MyName]" >
Replace this with an 'existential' test:
        <xsl:if test="name()=$TableColumns">
The RHS is a node list, so the = comes out true iff there is any node
in the list with a string value equal to the LHS.

Bar typos that should work: whether it turns out faster depends on too
many things for me to offer any guarantees!  For example a really
clever optimizer could reduce your expression to much the same thing.

Trevor Nash
--
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@xxxxxxxxxxxxx

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.