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

RE: Many sets of eyes ...

Subject: RE: Many sets of eyes ...
From: Curtis Burisch <burisch@xxxxxxxxxxx>
Date: Thu, 14 Feb 2002 10:33:58 +0000
curtis burisch
Hi Jeni, thanks for your reply!

>There are a couple of stylistic things that I'd do slightly
>differently. First, I'd use simply * rather than ./* - paths are
>always evaluated relative to the context node, so having ./ at the
>start of a path doesn't change what the path returns, just adds a
>couple of "line noise" characters (as the XQuery guys would apparently

>call them ;) to the expression. I'd also personally use [1] rather
>than [position() = 1] but that's just to avoid typing.

How embarassing ;-) ... I knew that!! I was .. er.. just testing you ;-)


>More importantly from a performance point of view, I'd use xsl:choose
>where I could. You currently have:

(snip!)

>The two conditions are mutually exclusive - either one is true or the
>other is true. So there's no need to test both of them - instead you
>can just use an xsl:choose, with one xsl:when (and the test) and an
>xsl:otherwise to catch the case when the test isn't true:

There are other cases which aren't currently handled by the stlyesheet. 
For instance, Alice, Andrew, and Alicia are known to drop by from time 
to time ;-) However, the choose/otherwise structure is far better.

(snip!)

>So the above is equivalent to:
>
>  <xsl:apply-templates select="joe" />
>  <xsl:apply-templates select="ann" />
>
>Which is also equivalent to:
>
>  <xsl:apply-templates select="joe | ann" />
>
>Which is actually in this case equivalent to:
>
>  <xsl:apply-templates select="*" />

I've decided to go with your second suggestion -- in real life the wrap 
element potentially contains many different tags...

>Oh, and I suppose that you could derive the "Joe says" or "Ann says"
>algorithmically from the name of the child element, by translating the

>first letter to a capital, with:

(snip)

I used 'Joe says' and 'Ann says' for demonstration purposes. In reality,
this is header data, and cannot be derived algorighmically from the 
source data. Interesting idea though! And a nice opportunity to use the 
translate function!!

>The final thing is that rather than having a template matching the
>root element and iterating over the wrap elements with an
>xsl:for-each, I'd have a separate template for the wrap elements -
>that's just stylistic thing, really. Since you're stripping out
>whitespace, and not adding anything in the template for the root
>element, you can get rid of the template for the root element
>altogether.

Done.

(snip)

>I hope you find these comments helpful,

Extremely. Thanks for your help Jeni -- I've managed to shave 12.5% off 
the execution time as a result.

Regards,
Curtis.

-- 

 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.