Subject: [xsl] Fwd: BOUNCE xsl-list@lists.mulberrytech.com: Non-member submission from ["Jeni Tennison" <jeni@tennison.2ndmail.com>] From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 09 May 2001 22:31:09 +0100 |
Date: Tue, 8 May 2001 04:37:45 -0400 (EDT)
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list-approval@xxxxxxxxxxxxxxxxxxxxxx
Subject: BOUNCE xsl-list@xxxxxxxxxxxxxxxxxxxxxx: Non-member submission from ["Jeni Tennison" <jeni@xxxxxxxxxxxxxxxxxxxx>]
X-Loop-Detect: 1
>From jeni@xxxxxxxxxxxxxxxxxxxx Tue May 8 04:37:34 2001
Received: from www.2ndmail.com (2ndmail.com [209.75.7.64])
by biglist.com (8.8.8/8.8.5/BL-2) with SMTP id EAA12434
for <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>; Tue, 8 May 2001 04:37:33 -0400 (EDT)
Date: Tue, 8 May 2001 04:37:33 -0400 (EDT)
Message-Id: <200105080837.EAA12434@xxxxxxxxxxx>
Received: (qmail 71698 invoked from network); 8 May 2001 08:38:51 -0000
Received: from localhost (HELO 2ndmail.com) (127.0.0.1)
by localhost with SMTP; 8 May 2001 08:38:51 -0000
From: "Jeni Tennison" <jeni@xxxxxxxxxxxxxxxxxxxx>
To: "Sabine Lehmann" <slehmann@xxxxxxx>
Cc: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Importance: Normal
X-Mailer: VisualMail 3.05 ( http://www.mintersoft.com/visualmail )
Subject: Re: [xsl] accessing specific elements
Mime-Version: 1.0
Content-type: text/plain; charset="iso-8859-1"
Hi Sabine,
> - count the tokens which have a domlex[@attribute='location'] > (this is no problem, I just use > count(//domlex[@attribute='location'])"/>)) > > - access only those tokens with an [@attribute='location'], so that > I can express > the condition: "If the first element with @attribute='location' > and the third have the same > value, then write out only one as the origin (and the middle one > as the destination). > > I thought of storing the value of the first in a variable and > comparing it with subsequent ones... but I can't get it work...
You can store them in a variable like:
<xsl:variable name="locs" select="/input_stream/chunk/token/domlex[@attribute = 'location']" />
(I step down from the root rather than using the descendant axis as it's likely to be more efficient - you might want to check the path to make sure it's right for your source XML.)
The $locs variable now contains three nodes - the three domlex elements with the @attribute attribute equal to 'location'. When you index into a node set like this, then their positions (as indicated in positional predicates like [1]) are relative to the other nodes in the node set. So you can get the first with $locs[1], the second with $locs[2] and the third with $locs[3].
So you should be able to use the following to get the kind of output that you're after.
Origin: <xsl:value-of select="$locs[1]/@value" /> <xsl:choose> <xsl:when test="$locs[1]/@value = $locs[3]/@value"> Destination: <xsl:value-of select="$locs[2]/@value" /> </xsl:when> <xsl:otherwise> Via: <xsl:value-of select="$locs[2]/@value" /> Destination: <xsl:value-of select="$locs[3]/@value" /> </xsl:otherwise> </xsl:choose>
I hope that helps,
Jeni
(this is a temporary address due to mailing problems - please use mail@xxxxxxxxxxxxxxxx)
Jeni Tennison http://www.jenitennison.com
======================================================
The most personalized email addresses available! at: http://www.2ndmail.com Say goodbye to that boring email address.
======================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Fwd: BOUNCE xsl-list@lists.mu, Wendell Piez | Thread | [xsl] Fwd: BOUNCE xsl-list@lists.mu, Wendell Piez |
[xsl] Fwd: BOUNCE xsl-list@lists.mu, Wendell Piez | Date | [xsl] Fwd: BOUNCE xsl-list@lists.mu, Wendell Piez |
Month |