[xml] wanted: an xpath expression

hi there,

I'v got a document describing a menu structure:

  <menu-item title="foo" id="boo"/>
  <menu-item title="bar">
    <menu-item title="baz"/>

each menu-item has an 'id' that is usually its title,
but can be an attribute 'id', if for example the title
is ambiguous.

I'm now writing a xslt template, applied to a given
'menu-item' node, and I want to know whether that node
contains a sub-menu-item with a given 'id' (defined as I
described above). What is the xpath expression for that ?

Here is a different way to state the search:

* for the 'descendant-or-self' axis:
  - if the node contains an 'id' attribute:
     * compare that
  - else compare the 'title' attribute

Can that be expressed in xpath notation at all ?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]