Re: [xsl] Somewhat Comlex XSL matching context node to an ancestor node

Subject: Re: [xsl] Somewhat Comlex XSL matching context node to an ancestor node
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 28 Apr 2002 20:36:52 -0400
At 2002-04-28 15:13 -0700, Derek Doerr wrote:
What I want to do is to use XSL to create a table that
has one row per class "team". In the first cell, show
the team number (the team 'id').  In the second cell,
show the names of the students in the team (e.g. "john
doe").

You have:


<xsl:for-each
select="/descendant::student[@id=self::student_id']/child::name">

You have misunderstood the purpose of self:: ... you want current() which will give you the current() node at the beginning of the evaluation of the expression:


/descendant::student[@id=current()/student_id]/child::name

I'm not sure where you are going with the rest of the template, but the select above should give you what you are looking for.

I hope this helps.

.................... Ken


-- Upcoming: 3-days XSLT/XPath and/or 2-days XSLFO: June 17-21, 2002 - : 3-days XML Information Modeling: July 31-August 2, 2002

G. Ken Holman                mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
ISBN 0-13-065196-6                      Definitive XSLT and XPath
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-07-1               Practical Formatting Using XSLFO
XSL/XML/DSSSL/SGML/OmniMark services, books(electronic, printed),
articles, training(instructor-live,Internet-live,web/CD,licensed)
Next public training:                  2002-05-06,07,09,10,13,20,
-                          06-04,07,10,11,13,14,17,20,07-31,08-05


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



Current Thread