Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Selecting First Node to Match Condition... Selecting First Node to Match Condition...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
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
