"Jason" <c_bananas@mighty.co.za> wrote in message
news:u6sSwRrBEHA.684@tk2msftngp13.phx.gbl...
> nvrmind found it :-)
>
> Thanks
> "Jason" <c_bananas@mighty.co.za> wrote in message
> news:ensVrMrBEHA.3132@TK2MSFTNGP11.phx.gbl...
> > HI
> >
> > thanks for the feed back
> >
> > what if my xml doc looks like this
> >
> > <root>
> > <child1>
> > <ex1>1</ex1>
> > <ex2>3</ex2>
> > </child1>
> > <child2>
> > <ex1>2</ex1>
> > <ex2>9</ex2>
> > </child2>
> > <child3>
> > <ex1>2</ex1>
> > <ex2>9</ex2>
> > </child4>
> > <child5>
> > <ex1>5</ex1>
> > <ex2>3</ex2>
> > </child5>
> > <child6>
> > <ex1>5</ex1>
> > <ex2>3</ex2>
> > </child6>
> > </root>
> >
> > Thanks again
> > Jason
> > "Martin Honnen" <Martin.Honnen@t-online.de> wrote in message
> > news:Oxc3f5pBEHA.1140@TK2MSFTNGP10.phx.gbl...
> > >
> > >
> > > Jason wrote:
> > >
> > > > to get the nodes of all unique values. for example there are 9
nodes,
> > each
> > > > of these nodes have a value. 1 node has a value of "test1", another
3
> > nodes
> > > > have a value of "test2" and another 5 nodes have a value of "test3".
> so
> > here
> > > > i have 9 nodes in total, but i know that 3 of them have the same
> value,
> > and
> > > > the other 5 have the same value. i want just 3 nodes returned
because
> > there
> > > > are 3 distinct values. exactly the same as if i were to do a "SELECT
> > > > DISTINCT surname FROM users" in SQL
> > >
> > > that is possible with the filter
> > > [not(. = preceding-sibling::element-name)]
> > > e.g. with the XML being
> > >
> > > <root>
> > > <child>1</child>
> > > <child>2</child>
> > > <child>1</child>
> > > <child>3</child>
> > > <child>1</child>
> > > <child>2</child>
> > > </root>
> > >
> > > and the script (JScript)
> > >
> > > var xmlDocument = new ActiveXObject('Msxml2.DOMDocument.4.0');
> > > xmlDocument.async = false;
> > > var loaded = xmlDocument.load('test20040310Result.xml');
> > > xmlDocument.setProperty('SelectionLanguage', 'XPath');
> > > var elements = xmlDocument.selectNodes(
> > > '//child[not(. = preceding-sibling::child)]');
> > > for (var i = 0; i < elements.length; i++) {
> > > alert(elements[i].text);
> > > }
> > >
> > > three elements with text 1, 2, 3 are found.
> > > --
> > >
> > > Martin Honnen
> > >
http://JavaScript.FAQTs.com/ > > >
> >
> >
>
>