Thanks, Dimitri, this looks like what I want. I shall try it out a bit
later on.
I didn't understand the reference to 'Julian' - I don't see an message form
him in htis thread, or have I missed something!
Iain
"Dimitre Novatchev" <dnovatchev@yahoo.com> wrote in message
news:bqb2v9$1vujd9$1@ID-152440.news.uni-berlin.de...[color=blue]
> I understand.
>
> As Julian has pointed out, the following XPath expression provides the
> attribute of the first ancestor (or self, if no ancestor has such[/color]
attribute)[color=blue]
> in document order:
>
> ancestor-or-self::*/@WindDing
>
> So, if a node does not have a "WindDing" attribute, it should inherit it
> from the earliest ancestor that has it ?
>
> Or, will this node inherit the attribute from the nearest ancestor ?
>
> In case a node already has such-named attribute specified, then it should
> not inherit from its ancestors ?
>
>
> =====
> Cheers,
>
> Dimitre Novatchev.
>
http://fxsl.sourceforge.net/ -- the home of FXSL
>
>
>
> "Iain" <idownsXXXX@dircon.co.uk> wrote in message
> news:cb7yb.433$5u2.22@newsfep1-gui.server.ntli.net...[color=green]
> > I'm sorry if this is not clear.
> >
> > I intended to indicate a configuration file with an hierarchical set of
> > nodes whereby TOWN was found in COUNTRY was found in REGION.
> >
> > Towns at the bottom level in my example had names like Ontario, Quebec[/color][/color]
and[color=blue][color=green]
> > London.
> >
> > Each town has a property (just made up as on example) called WingDing[/color]
> which[color=green]
> > contains the name of a colour.
> >
> > It is may aim that the WingDing property can be applied at any level as[/color][/color]
a[color=blue][color=green]
> > kind of default. SO if there is a 'WingDing' property set at a REGION[/color]
> level[color=green]
> > then it will apply to all TOWNs in all COUNTRYs in that region unless
> > over-ridden at a COUNTRY or TOWN level.
> >
> > What I want to do is to effectively find any give TOWN and a full set of
> > properties for that town regardless of if the property is set in the[/color][/color]
TOWN[color=blue][color=green]
> > node or the higher level COUNTRY or REGION node containing it.
> >
> > My expectation was that I could do this using XSLT to find the node with[/color]
> an[color=green]
> > XPath search and then to populate it with a known set of properties[/color][/color]
which[color=blue][color=green]
> > were present in that node or in a containing node.
> >
> > I have never used XSLT (or much XPath) and it seemed that I could see
> > complex hard to maintain approaches, but rather hoped there was an[/color][/color]
elegant[color=blue][color=green]
> > approach which I had missed. Hence I threw myself on the mercy of the[/color]
> list![color=green]
> >
> > Obviously in my real world applicaitons there could be many levels of
> > nesting of the nodes dozens or hundreds of different isntances at any[/color]
> level[color=green]
> > and many attributes.
> >
> > I would also be interested in applying the same techniques to elements,[/color]
> but[color=green]
> > I imagine that solving the attribute case solves the element case too.
> >
> > I hope this makes a bit more sense.
> >
> > One of the actual applications is for a text formatting application[/color][/color]
where[color=blue]
> I[color=green]
> > wish to be able to set a font at the top level of a set of XML based[/color]
> object[color=green]
> > descriptions and override it in sub areas, panels, and specific text
> > instances. Holding the font in all places where it may be (for a[/color][/color]
complex[color=blue][color=green]
> > description) would be cumbersome and hard to maintain (the specific
> > application is to provide a layout template which I would wish to[/color][/color]
maintain[color=blue][color=green]
> > manually - requiring a font object in all bottom level text descriptions
> > would make for a lot of typing).
> >
> > Iain
> > "Dimitre Novatchev" <dnovatchev@yahoo.com> wrote in message
> > news:bqa0i0$1ug329$1@ID-152440.news.uni-berlin.de...[color=darkred]
> > > I am sorry, but it is not clear what you want to achieve -- can you[/color]
> > provide[color=darkred]
> > > a complete example and explantion?
> > >
> > > I find this text quite contradictory:
> > >
> > > > Then I want to find a node (E.g. NorthAmerica/Canada/Ontario) and[/color][/color]
> create[color=green][color=darkred]
> > > an
> > > > XML Node with the values in that node PLUS any other values in nodes
> > > higher
> > > > up.
> > > >
> > > > Specifically for any attribute I should pick the lowest occuring[/color][/color]
> value.[color=green][color=darkred]
> > > > Quebec would have a WIngDing of Yellow ('inheriting' from the Region
> > > node),
> > > > Quebec, Brown and London Orange.
> > > >
> > >
> > >
> > > First you are speaking about NorthAmerica/Canada/Ontario , but then[/color][/color][/color]
you[color=blue][color=green][color=darkred]
> > > start speaking about Quebec ... ???
> > >
> > > What is the meaning of this:
> > >
> > > > Specifically for any attribute I should pick the lowest occuring[/color][/color]
> value.[color=green][color=darkred]
> > > > Quebec would have a WIngDing of Yellow ('inheriting' from the Region
> > > node),
> > > > Quebec, Brown and London Orange.
> > > >
> > >
> > >
> > > =====
> > > Cheers,
> > >
> > > Dimitre Novatchev.
> > >
http://fxsl.sourceforge.net/ -- the home of FXSL
> > >
> > >
> > > "Iain" <idownsXXXX@dircon.co.uk> wrote in message
> > > news:dHZxb.225$5u2.204@newsfep1-gui.server.ntli.net...
> > > > I want to create an XML configuration file which might look like
> > > >
> > > > <REGION Name="Europe" WingDing="Blue">
> > > > <COUNTRY Name="UK" WingDing="white">
> > > > <TOWN Name="London" WingDing="Orange" />
> > > > </COUNTRY>
> > > > </REGION>
> > > > <REGION Name="NorthAmerica" WingDing="Yellow">
> > > > <COUNTRY Name="Canada">
> > > > <TOWN Name="Quebec" WingDing="Brown" />
> > > > <TOWN Name="Ontario" />
> > > > </COUNTRY>
> > > > </REGION>
> > > >
> > > > Then I want to find a node (E.g. NorthAmerica/Canada/Ontario) and[/color][/color]
> create[color=green][color=darkred]
> > > an
> > > > XML Node with the values in that node PLUS any other values in nodes
> > > higher
> > > > up.
> > > >
> > > > Specifically for any attribute I should pick the lowest occuring[/color][/color]
> value.[color=green][color=darkred]
> > > > Quebec would have a WIngDing of Yellow ('inheriting' from the Region
> > > node),
> > > > Quebec, Brown and London Orange.
> > > >
> > > > Finding the node is easy with XPath, but I'm unsure how to pick the[/color]
> > lowest[color=darkred]
> > > > occuring attribute value, some kind of max(depth) operator would be
> > > required
> > > > and I do not seem to find one int my reference books. This sort of[/color]
> > thing[color=darkred]
> > > > can often be done with a chain of ifs, but it is inelegant.
> > > >
> > > > Can any one make any suggestions?
> > > >
> > > > thanks in advance
> > > >
> > > > Iain
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]