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

accessing specific elements

Subject: accessing specific elements
From: Sabine Lehmann <slehmann@xxxxxxx>
Date: Mon, 07 May 2001 16:27:37 +0200
specific elements
Hi,

I have the following problem.  Imagine the concept of  a flight
'Brussels - London - Brussels' encoded in XML as follows:

<input_stream>
 <chunk>
   <token>
...
...
   </token>
  </chunk>
 <chunk >
    <token>
      <normalized.form>Brussels</normalized.form>
      <domlex attribute="location" subattribute="val" value="Brussels"/>

   </token>
   <token>
      <normalized.form>London</normalized.form>
      <domlex attribute="location" subattribute="val" value="London"/>
  </token>
  <token>
      <normalized.form>and</normalized.form>
  </token>
    <token>
      <normalized.form>Brussels</normalized.form>
      <domlex attribute="location" subattribute="val" value="Brussels"/>

  </token>
</chunk>
...
...
</input_stream>


So, <chunk> contains 4 <token> elements out of which
only 3 have a domlex[@attribute='location'], namely the 1st, 2nd and
4th.

Now *irrespective of their sequential order*, I would like to

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

I don't know how to access only the tokens which do have
domlex[@attribute='location'].

Can anybody help me?

Thanks in advance

Sabine




 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.