This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

keys vs. parameters


Since I learned something with the last question let me try again....

Any opinions on using keys versus passing the same information down through
multiple templates using parameters?  In this case we have something like:

	<xsl:key name="inreq" match="req:request/req:params/*" use="@name"/>

Which I subsequently use like:

    <xsl:value-of select="normalize-space(key( 'inreq', local-name() ))"/>

several levels of template down.  I happen to have templates that match each
step of the way and I could grab the data of interest in the first template
using something like:

	<xsl:variable name="inreq"><xsl:copy-of
select="req:request/req:params/*"/></xsl:variable>

This would then be passed through each template as a parameter to the next
one (five templates involved in total).  I'm assuming using the key is the
way to go, but thought I'd check....

Assuming keys are the best, a somewhat related issue comes up when using
external documents and/or extensions.  From what I understand, there is no
way of building a key on the external document (results from document()) or
a nodeset returned from an extension?  In such cases I presume I'm forced to
pass the results through each template as a parameter?  Eg, I'd like to be
able to do something like:

	<xsl:key name="collection"
match="java:CollectionHandler.getCollection($collection_id, $group_id )"
use="local-name()"/>

but Xalan chokes on this (as I assume would other processors)...
($collection_id and $group_id are global parameters to the template).

Peter Hunsberger

Phone: 901-495-5252
E-mail: Peter.Hunsberger@stjude.org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]