On Wednesday, March 13, 2002, at 03:05 PM, Grainne Reilly wrote:
I agree that this is valid xpath syntax - the following is in the XPath spec (http://www.w3.org/TR/xpath):
../@lang selects the lang attribute of the parent of the context node
I have used this in xslt to select attributes (as shown above) as opposed to restricting on their existence (using the attribute as a predicate e.g.
../[EMAIL PROTECTED]). I am pretty sure it is not an xslt extension to xpath.
I have also tried the same type of query using the java client and it did not return the attributes. Perhaps Xindice currently only handles returning elements and their attributes and not attributes by themselves?
This is correct, and is a known limitation. The server is executing the query, the result just can't be returned because there is no node to include it in. It's actually something that needs to be fixed in the XML:DB API. It will probably be a couple revisions before this gets fixed though.
Grainne.
At 10:28 PM 13-03-02 +0100, you wrote:
Yes, I am sure, my syntax is legal. I tested following xpath expression with another software (xmlspy) and got the expected results: xpath="//thema/@index "
With this query I want to get the "index" - Attributes of all "thema" nodes,
this expression is in my opinion a legal xpath expression .
At 13:59 13.03.2002 -0700, you wrote:
My java client is an application. As part of the application, I do "searches".
My searches are pretty much pre-defined. The samples I listed below
really look like:
.. .. .. _tagName = _st.nextToken(); xpath = "//*/"+_tagName+"[@"+_st.nextToken()+"='"+getText()+"']"; } else if (_foundRootAttribute) { _st = new StringTokenizer(getFieldName(), "."); _tagName = _st.nextToken(); xpath = "/"+_tagName+"[@"+_st.nextToken()+"='"+getText()+"']"; } else { xpath = "//*/"+getFieldName()+"[text()='"+getText()+"']"; .. .. ..
However, I went to the xpath tutorial and all the attribute queries use
the "[EMAIL PROTECTED]'someText']". I don't know if you can do it your way?
The final answer, as Tom has pointed out, is the XPath Documentation on
W3C. Check there and see if you syntax is legal for XPath. If it is, then
Xindice
should support it and if it doesn't then it is probably a bug. Does it work
from the
command-line?
HTH,
Mark
"Mag. Josef Fritsch" wrote:
> What does your java client on following xpath-Expression:
>
> xpath="//myTag/@attribute"
>
> At 13:04 13.03.2002 -0700, you wrote:
> >Some samples...
> >
> >Looking for an attribute...
> >
> > xpath = "//*/[EMAIL PROTECTED]'someText']";
> >
> >Looking for an attribute from the root:
> >
> > xpath = "/[EMAIL PROTECTED]'someText']";
> >
> >Looking for a Tag:
> >
> > xpath = "//*/myTag[text()='myTagText']";
> >
> >
> >XPath Tutorial:
> >
> > http://www.zvon.org/xxl/XPathTutorial/General/examples.html
> >
> >
> >Mark
> >
> >"Mark J. Stang" wrote:
> >
> > > I have a java client that does xpath queries. It queries on both
> > > attributes and tags. I have tested most of the xpath searches as
> > > part of my application, so it does work. Typically, your query isn't
> > > correct ;-). What does your document look like and your
> > > query?
> > >
> > > Mark
> > >
> > > "Mag. Josef Fritsch" wrote:
> > >
> > > > Hey Mark,
> > > > thank you very much for answering. I know the problems with the windows
> > > > command-line. I tested my xpath-Expressions with java-xsp under
> > cocoon2 and
> > > > i suspect this is a bug in xindice. It would be very interesting for
> > me if
> > > > anyone has tested similiar expressions with a java client.
> > > > Best Regards
> > > > Joe
> > > >
> > > > At 09:32 13.03.2002 -0700, you wrote:
> > > > >The best solution for windows is to put it in double quotes. If you
> > > > >send me your entire command-line, I can tell you where to put the
> > > > >quotes. The problem is that windows is parsing your query rather
> > > > >than passing it into xindice. So if you put quotes around it, then
> > > > >windows will pass it in untouched.
> > > > >
> > > > >Mark
> > > > >
> > > > >Jan Metzner wrote:
> > > > >
> > > > > > > I have installed xml-xindice-1.0rc2 on Win2000. Everything
> > works fine,
> > > > > > > only xpath - Expressions like:
> > > > > > > //[EMAIL PROTECTED]'Sprenger'] or
> > > > > > I don't use windows, but it is possible that you have to escape the
> > > > > > query if you use the command line client:
> > //[EMAIL PROTECTED]'Sprenger\']
> > > > > > > //[EMAIL PROTECTED]
> > > > > > this should work.
> > > > > >
> > > > > > Jan
Kimbro Staken - http://www.kstaken.org - http://www.xmldatabases.org Apache Xindice native XML database http://xml.apache.org/xindice XML:DB Initiative http://www.xmldb.org Senior Technologist (Your company name here)