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]

RE: RE: Forming a Tree


> 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@ntlworld.com
work: Michael.Kay@softwareag.com 


 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]