The following XUpdate query, which uses XPath works under Xindice no probs:
<xupdate:modifications version="1.0" xmlns:xupdate="http://www.xmldb.org/xupdate"> <xupdate:update select="/Classes/Class[last()]/@id">999</xupdate:update> </xupdate:modifications> please note the XPath: /Classes/Class[last()]/@id Why does it work for XUpdateQueryService, but not for XPathQueryService? I may have a play around with the source code to see what's happening. Thanks Dominic Gamble On Fri, 2002-04-05 at 17:49, Mark J. Stang wrote: > For example: > > xindice xpath -c /db/customers -q "/[EMAIL PROTECTED]'Stang']" > > will return all documents that have a root element named > account with an attribute of 'Stang'. In my previous example, > if my document contained an element with an attribute of "mark", > then it would return the entire element... > > HTH, > > Mark > > "Mark J. Stang" wrote: > > > Everyone is correct, it doesn't work. It is not Xindice, but rather > > the XML:DB or DB:XML or something like that API that doesn't > > support it. So until the API is updated, Xindice doesn't support > > it. HOWEVER, this is not to say that you can't get back the > > node that contains the attribute. I have nodes like: > > > > <name first="mark" last="stang" /> > > > > And I do searches for "mark" or "stang" and they work, they just > > return then entire node. So, you get more than you asked for. > > And if you search for an attribute of the root node, then you can > > get the entire document. > > > > Check out: > > > > http://www.zvon.org/xxl/XPathTutorial/General/examples.html > > > > I have yet to find any bugs in the XPath queries :-). > > > > HTH, > > > > Mark > > > > Maarten Eerdekens wrote: > > > > > Xindice can only return a nodeset as a result of a xpath query, > > > and because attributes are no nodes, this returns nothing. > > > You will have to make a work around. > > > I think I heard the experts are working on it. > > > > > > -----Original Message----- > > > From: Dominic Gamble [mailto:[EMAIL PROTECTED] > > > Sent: vrijdag 5 april 2002 8:55 > > > To: xindice-users@xml.apache.org > > > Subject: Xindice doesn't fully support XPath? /@attribute doesn't work! > > > > > > It seems that XPath /@attribute queries don't work in Xindice! Please > > > tell me I am wrong. > > > > > > When I execute the following xpath query: > > > > > > xindice xpath -c /db/websystem -q "/Classes/Class[last()]" > > > > > > I get the following results: > > > > > > <?xml version="1.0"?> > > > <Class name="Page" id="1" superclass="1" template="1" > > > xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/websystem" > > > src:key="class"> > > > <Elements> > > > <Element name="Title" class="Single Line Text" > > > required="true" /> > > > <Element name="Author" class="Single Line Text" > > > required="false" /> > > > <Element name="Keywords" class="Single Line Text" > > > required="false" /> > > > <Element name="Description" class="Single Line Text" > > > required="false" > > > /> > > > </Elements> > > > </Class> > > > > > > This is all ok, but when I then attempt to get the attribute 'id' only, > > > using the following query: > > > > > > xindice xpath -c /db/websystem -q "/Classes/Class[last()]/@id" > > > > > > I get NOTHING! This happens both from the command line, _and_ from > > > within code. > > > > > > Does anyone know why? Has it just not been implemented? > > > I'm using Xindice 1.0. > > > > > > Thanks, > > > Dominic Gamble > > > Stratlink >