"Martin Peck [MSFT]" <mpeck@online.microsoft.com> wrote in message
news:##Lvj1IHEHA.956@TK2MSFTNGP09.phx.gbl...
> Brad,
>
> XPath will allow you to specify which nodes in your input document you
want
> to select. XPath statements will return a list of nodes that match your
> statement. XPath itself won't transform your XML into another format.
>
> If what you're trying to do is generate an output document that has a
> different format from the input document then perhaps XSLT is what you're
> really after. XSLT will allow you to transform an input XML document into
an
> output XML document, and as part of that transform you will specify an
XPath
> to tell the transform which parts of the input document you'd like
> tranformed (e.g. "transform all of the Canadian authors only").
>
>
http://www.xml.com/pub/a/2000/08/holman/index.html give a good write-up of
> XSLT.
>
> There are other ways of generating your output XML (using a DOM, using
> custom code) but they really depend upon what you're doing. For example,
if
> you're dealing with XML files, if you're dealing with XML that's already
> been loaded into a DOM, if you're dealing with XML that's part of a
stream.
>
> Regards,
>
> Martin
>
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
> "Brad" <veloearl@hotmail.com> wrote in message
> news:923c671f.0403310638.33f41a2e@posting.google.com...
> > Let's say I have the following XML:
> >
> > <authors>
> > <author>
> > <name>Mike Galos</name>
> > <nationality>French</nationality>
> > </author>
> > <author period="modern">
> > <name>Eva Corets</name>
> > <nationality>British</nationality>
> > </author>
> > <author>
> > <name>Cynthia Randall</name>
> > <nationality>Canadian</nationality>
> > </author>
> > <author>
> > <name>Stefan Knorr</name>
> > <nationality>Canadian</nationality>
> > </author>
> > <author period="modern">
> > <name>Paula Thurman</name>
> > <nationality>British</nationality>
> > </author>
> > </authors>
> >
> > I want to use an XPath expression to select all Canadian authors, but
> > want the results to be nested within their ancestor like so:
> >
> > <authors>
> > <author>
> > <name>Cynthia Randall</name>
> > <nationality>Canadian</nationality>
> > </author>
> > <author>
> > <name>Stefan Knorr</name>
> > <nationality>Canadian</nationality>
> > </author>
> > </authors>
> >
> > Is this possible with XPath? If I use
> >
> > /authors/author[nationality='Canadian']/ancestor-or-self::*
> >
> > as my XPath expression, I get back the root node and all it's
> > descendants, which is not what I want.
>
>
Outgoing mail is certified Virus Free.
).