|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] accessing 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








