My XSL (1.0) reference doesn't have any reference to the <xsl:key> and
the <xsl:key> FAQ I've reviewed provides some examples and answers
specific questions, it does not provide a general overview. I'm been
entirely unsucessful in accessing the nodes I'm trying to associated
with the key.
Do keys have to be used within a context in which the associated nodes
exist?
During my XLS processing a create a set of nodes (which I change to a
node-set). This set of nodes could be viewed as a set of indexes or
keys. My primary processing involving looping through this set of
constructed nodes. For each node I then process a subset of nodes
loaded from the XML file; this set of nodes are not children or siblings
of the constructed nodes.
This is where I am attempting to apply the key construct, but it appears
to always return a empty node list. Maybe my key generation logic is
flawed, but unless I'm really confused, at worst case I might always get
a key of '1'. I've included pieces of the original XSL; there's too
much to provide a complete context.
<!--
# Template which triggers processing for all rows associated with a
PageNode.
#
# CONTEXT: PageNode
-->
<!--**PATCH**-->
<xsl:key name="PageKey" match="/gnsl:Results/gnsl:Table/gnsl:Row"
use="((count(preceding-sibling::*) div $RowsPerPage) + 1)" />
<!--**PATCH**-->
<xsl:template name="ProcessPageRows">
<xsl:variable name="PageNum" select="@PageNum" />
<xsl:variable name="StartRow" select="@StartRow" />
<xsl:variable name="EndRow" select="@EndRow" />
<xsl:if test="$NumberOfRows">
<!--**PATCH**
xsl:for-each select="$AllInputRows[ (position() >= $StartRow)
and
(position() <= $EndRow) ]"
**PATCH**-->
<xsl:for-each select="key('PageKey',$PageNum)">
<xsl:apply-templates select="." />
</xsl:for-each>
</xsl:if>
</xsl:template>
--
Edward L. Knoll Phone (work) : (719)484-2717
e-mail (work) :
ed(_dot_)knoll(_at_)cosd(_dot_)fedex(_dot_)com
e-mail (business): eknoll(_at_)sf-inc(_dot_)com
e-mail (personal): edward(_at_)elknoll(_dot_)com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list