[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Fwd: BOUNCE xsl-list@lists.mulberrytech.com: Non-me

Subject: Fwd: BOUNCE xsl-list@l...: Non-member submission from ["Jeni Tennison" <jeni@t...>]
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 09 May 2001 22:31:09 +0100
sabine wendell
Another message from Jeni that bounced:

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: 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.

======================================================


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.