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

Re: parameters in XSLT 2.0

Subject: Re: parameters in XSLT 2.0
From: Bruce D'Arcus <bdarcus@xxxxxxxxx>
Date: Wed, 8 Jun 2005 23:55:42 -0400
xslt quot
On Jun 8, 2005, at 4:36 PM, Michael Kay wrote:

For example, first I have this variable to [expletive deleted] in outside data:

   <xsl:variable name="raw-biblist">
     <modsCollection xmlns="http://www.loc.gov/mods/v3"
       xmlns:bib="http://purl.org/NET/xbiblio/citeproc">
       <xsl:copy-of select="$bibrecord/*/mods:mods"/>
     </modsCollection>
   </xsl:variable>

It's certainly not obvious that copying the source data in this way is achieving anything useful.

The bibrecord variable that's getting copied there typically draws in documents via document() over http (with a flatfile option as well) with stuff like:


<xsl:copy-of
select="doc(concat(&quot;http://localhost:8080/exist/servlet/db/mods? &quot;,
&quot;_query=declare%20namespace%20mods=%22http://www.loc.gov/mods/ v3%22;&quot;,
&quot;%20for%20$citekey%20in%20&quot;, $citekeys,
&quot;%20return%20//mods:mods[@ID=$citekey]&amp;_howmany=-1&quot;))"/>


So in this case I'm pulling in the data from using XQuery to the eXist REST interface.

I didn't know about sequences when I wrote it originally, and am not sure even now if I can do this:

<xsl:variable name="bibrecord" as="element()+">
<xsl:sequence
select="doc(concat(&quot;http://localhost:8080/exist/servlet/db/mods? &quot;,
&quot;_query=declare%20namespace%20mods=%22http://www.loc.gov/mods/ v3%22;&quot;,
&quot;%20for%20$citekey%20in%20&quot;, $citekeys,
&quot;%20return%20//mods:mods[@ID=$citekey]&amp;_howmany=-1&quot;))"/>
</xsl:variable>


Possibly: I can't see what the apply-templates calls are doing, so it's hard
to tell. If the apply-templates calls are creating new elements, then
there's probably no extra cost (in fact it may be cheaper) to wrap these
elements in a document node (a temporary tree). If there's a saving to be
made, then it will be made by avoiding creating new nodes (or copying
existing nodes).

OK. Those templates are grouping/sorting, and in one case also adding nodes. I reorganized a few of those templates today to just pass some (tunnel) parameters though, in part because it simplified the code.


If I understand right, so long as the node content doesn't change and I'm just grouping and/or sorting and passing parameters, then I don't need to use a temporary tree. Right?

Two things are worth remembering about performance engineering:

(a) don't tune your code unless it is failing to meet its performance
requirements.

(b) the only way to know whether your tuning attempts are worthwhile is to
make measurements before and after.

OK, thanks.


Bruce

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.