RE: RE: [xsl] Forming a Tree

Subject: RE: RE: [xsl] Forming a Tree
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Fri, 12 Jul 2002 18:04:01 +0100
> Hi Michael,
> Thanks for the response. I am new to XSL and I never used xsl:key, 
> could you pl help me, how to write the xsl:key for 
> <xsl:for-each select="//row[@ParentTopicId=@TopicId and 
> @BookId=$node1/@BookId and @TopicTitle]">. In xsl:for-each i 
> am using a variable, i am not getting how to 
> write xsl:key.
> 
The variable part of that expression is @BookId.

So

<xsl:key name="k" 
  match="row[@ParentTopicId=@TopicId and @TopicTitle]"
  use="@BookId"/>

then

<xsl:for-each select="key('k', $node1/@BookId)">

The key indexes all the rows that satisfy the "fixed" conditions by the
value of their @BookId. The select expression finds entries in that
index by supplying the required BookId. 

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


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


Current Thread