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

A general <xsl:key> question.

Subject: A general <xsl:key> question.
From: "Edward L. Knoll" <ed.knoll@xxxxxxxxxxxxxx>
Date: Thu, 05 Dec 2002 09:40:03 -0700
key empty node list
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() &gt;= $StartRow)
and
                                           (position() &lt;= $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.knoll@xxxxxxxxxxxxxx
                  e-mail (business): eknoll@xxxxxxxxxx
                  e-mail (personal): edward@xxxxxxxxxxx

 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.