Closed Bug 205068 Opened 21 years ago Closed 10 years ago

Document JavaScript XPath usage

Categories

(Documentation Graveyard :: Web Developer, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: hjtoi-bugzilla, Assigned: axel)

References

()

Details

We need a small blurb on http://www.mozilla.org/projects/xslt/ that we support
the DOM Level 3 XPath API, a link to the spec, and a small example like we have
for XSLT from JS in here: http://www.mozilla.org/projects/xslt/js-interface.html

Also I would advice changing the main XSLT title to include XPath, something like:

XSL Transformations (XSLT) and XPath in Mozilla

I have gotten several requests recently asking about our XPath API support and
the best I could do was point them to the spec and the XSLT page. There
isna'treally anything that tells them we support it and figuring things out from
the spec is not trivial.
I can check in the files if someone just provides the content...
You might get more responses if you posted a 1-2 paragraph description of how
this all works in this bug, to get things started. Someone else might take an
interested, learn about XPath, and write the document, you never know :)
excuse me, we know that you want docs. Everybody does. Stop nagging.
There are more important things on the lists of those that actually would
contribute the content. There are even more important docs.
Seeing this bug I was playing with it once again:

A) I've downloaded MSXML 4.0 SP2, installed it, searched help, copied example
and in less then 15 minutes I've got the results I'd expected to get.

B) I've tried the same for DOM3 XPath and Mozilla willing to write the docs. In
about two hours I completely lost my feeling I understood it. And it's only two
weeks I needed XPath in some script... Perhaps wrong build number (20030605),
who knows...

OK, maybe I'm dumb. Oh yeah, from what I've heard from people trying to use
XPath2, XSLT2 and other XMLSchema based trash, I'm not the only one.
Hmm. I could maybe do this. How much information is required? Somthing like:
Basic calls (document.evaluate)
Return types (snapshots / iterators)
Namespace resolvers (difference between XHTML and HTML)

Or something less specific?
Thank you for volunteering.

We should have examples for the common return types, and how to work on HTML and
XML documents, the latter with and without namespaces. Make an example using
a node as namespace resolver as well as an explicit js one, so that users see
how to work with default namespaces.

This sounds like quite a bit of work, but I'd be fine with landing this in chunks.
OK, so I've done a little here but work has temporarily stalled. There's a
snapshot of the work-in-progress at
http://www-jcsu.jesus.cam.ac.uk/~jg307/mozilla/xpath-tutorial.html
(In reply to comment #8)
> OK, so I've done a little here but work has temporarily stalled. There's a
> snapshot of the work-in-progress at
> http://www-jcsu.jesus.cam.ac.uk/~jg307/mozilla/xpath-tutorial.html

I looked over this, it's a pretty good start. A few comments though. On the 
source, mozilla.org content is short lines, not a single line per paragraph.
The markup is probably allright, didn't check that closely. I assume that you 
followed http://www.mozilla.org/contribute/writing/guidelines, as you use the 
m.o stylesheets already.

I'm no big fan of //foo expressions, as you used them like /descendent::foo,
which is faster. In most cases, it won't really matter, but I'd prefer to see
us giving good examples (yes, one can optimize that in the engine, too).

In the XML part, you should call HTML XHTML, just to make the difference clear.
Are you going to provide us with an example, too?

There are a few edges in the english, but I guess we'll iron those out later.
IMHO //foo expressions are clearer to read so I think that's what should be used
in helppages. It might be a good idea to have an optimization section though
where // vs. descendant:: is discussed.
This bug has been buried in the graveyard and has not been updated in over 10 years. It is probably safe to assume that it will never be fixed, so resolving as WONTFIX.

Please file new issues against MDN in the "Developer Documentation" product.
https://developer.mozilla.org/en-US/docs/Web/XPath
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.