Subject: [xsl] A general <xsl:key> question. From: "Edward L. Knoll" <ed.knoll@xxxxxxxxxxxxxx> Date: Thu, 05 Dec 2002 09:40:03 -0700 |
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.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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Key and/or grouping quest, Edward L. Knoll | Thread | Re: [xsl] A general <xsl:key> quest, Jeni Tennison |
Re: [xsl] sequential navigation pro, Jakob . Fix | Date | Re: [xsl] A general <xsl:key> quest, Jeni Tennison |
Month |