For example, first I have this variable to suck 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.
Then I have this variable, which creates the enhanced data
you mention above:
<xsl:variable name="enhanced-biblist">
<mods:modsCollection
xmlns:bib="http://purl.org/NET/xbiblio/citeproc">
<xsl:choose>
<xsl:when test="$sort_order-bib='citekey'">
<xsl:apply-templates
select="$raw-biblist/mods:modsCollection" mode="sort_citekey"/>
</xsl:when>
<xsl:when test="$sort_order-bib='cited'">
<xsl:apply-templates
select="$raw-biblist/mods:modsCollection" mode="sort_cited"/>
</xsl:when>
<xsl:when test="$sort_order-bib='author-year'">
<xsl:apply-templates
select="$raw-biblist/mods:modsCollection" mode="sort_author-year"/>
</xsl:when>
</xsl:choose>
</mods:modsCollection>
</xsl:variable>
... and then I do:
<xsl:variable name="bib:formatted-biblist">
<xsl:apply-templates
select="$enhanced-biblist/mods:modsCollection/mods:mods"
mode="temp-placeholder"/>
</xsl:variable>
The thinking that prompted my question is that maybe the
enhanced data
gathered in the sort* modes in the second variable could be condensed
down to a few (tunnel) parameters, rather than the 8 or so nodes I
create in the temporary tree.
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).
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.
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
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>
--~--