Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Selecting First Node to Match Condition... [Thread Next] Re: Selecting First Node to Match Condition...To: NULL Date: 1/3/2007 11:39:00 AM > (preceding-sibling::default[1] | > ..\preceding-sibling::default[1])[last()] of course, must be: (preceding-sibling::default[1] | ../preceding-sibling::default[1])[last()] "Dimitre Novatchev" <dimitren@t...> wrote in message news:459b1fb3$0$97256$892e7fe2@a...... >> 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. >> > > > (preceding-sibling::default[1] | > ..\preceding-sibling::default[1])[last()] > > > Cheers, > Dimitre Novatchev > > > "KW" <kevinw@a...> wrote in message > news:1167777226.929900.7370@n...... >> 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 | |||
|
