This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: RE: Forming a Tree
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 12 Jul 2002 18:04:01 +0100
- Subject: RE: RE: [xsl] Forming a Tree
- Reply-to: xsl-list at lists dot mulberrytech dot com
> 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