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

XPath: following sibling/cousin n-times removed??

Subject: XPath: following sibling/cousin n-times removed??
From: "Lars Huttar" <lars_huttar@xxxxxxx>
Date: Wed, 14 May 2003 15:17:42 -0500
xpath following sibling
Hi all,

I have another XPath efficiency question.

Sample XML data:
<llcd:word>
  <llcd:morpheme>1</llcd:morpheme>
  <llcd:stretch><llcd:morpheme>2</llcd:morpheme></llcd:stretch>
  <llcd:stretch>
    <llcd:stretch><llcd:morpheme>3</llcd:morpheme></llcd:stretch>
    <llcd:morpheme>4</llcd:morpheme>
  </llcd:stretch>
</llcd:word>
<llcd:word>
  <llcd:morpheme>5</llcd:morpheme>
</llcd:word>

What I want to do: when the current node is a morpheme, I want to
test whether it is the last morpheme in the current word or not.
As you can see, morphemes are always contained by words, though
perhaps not directly.  There can be intervening container elements
such as "stretch".
Incidentally words do not have words as ancestors (but words can be
contained in stretches).
To make a long story short, words contain morphemes, but stretches
can intervene at any and every level.

My current test is:
"following::llcd:morpheme[1][generate-id(ancestor::llcd:word) =
generate-id(current()/ancestor::llcd:word[1])]"

This will be true if the current node (a morpheme) is not the last
morpheme in its word.

The question is, is there a better way?  (Clearer or more efficient?)

Again, this is not a big deal, because I think I have a working expression.
Ideas are appreciated though.

Thanks,
Lars


 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.