Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Selecting First Node to Match Condition...

From: "KW" <kevinw@------.--.--->
To: NULL
Date: 1/2/2007 2:34:00 PM

Let's say I have some XML like this...

<section>
  <default>
    <width>100</width>
    <height>200</height>
  <default>
  <group>
    <box>Box1</box>
    <box>Box2</box>
  </group>
  <group>
    <default>
      <width>500</width>
      <height>300</height>
    <default>
    <box>Box3</box>
    <box>Box4</box>
  </group>
  <default>
    <width>800</width>
    <height>700</height>
  <default>
</section>

And, let's say when processing each box element, I want to use the most
"relevant" default width and height when rendering the box in html. So,
for Box1 and Box2, the most relevant would be the default settings just
beneath the section element, but for Box3 and Box4, the most relevant
would be  the default settings just prior to the box elements. The
800/700 values would actually not be used for any of the boxes in this
example.

I need an XPath expression to select the most relevant "default"
element based on the context of the box currently being processed.

I think I want something like this (in English)...

Select the first <default> node that is either a...
    previous sibling of the current box,
    or a child of an ancestor (that is not my direct parent) of the
current box
    as long as the matching node comes before the current box.

Basically, I want to let my developers specify default settings at any
level, and then override default settings at lower levels, if
necessary.

I appreciate any help on this!

Kevin



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent