- From: Michael Dyck <MichaelDyck@home.com>
- Date: Wed, 17 Jan 2001 01:05:09 -0800
- To: Jeff Lansing <jeff@polexis.com>
- CC: www-xml-linking-comments@w3.org
Jeff Lansing wrote:
>
> How do I point to the string "Valley Center" in the following xml?
>
> <doc>
> <text>New <bold>River Valley</bold> Center Shops<text>
> <doc>
>
> How do I do it without the string-range function, I mean?
I don't think you can do it without string-range.
> Is it:
> xpointer(/doc/text/bold/text()/point()[7]/range-to(...)) ?
No. The XPath
/doc/text/bold/text()
yields a location-set consisting of the text node whose string-value is
"River Valley", but when you append "/point()", which is an abbreviation of
"/child::point()", you're asking for all the children of that text node that
are points. This might sound like what you want, but in fact, the `child'
axis of a text node is empty. (So the expression yields an empty
location-set, and thus the XPointer has a sub-resource error.)
You're the fourth person to post to this mailing list thinking that there
was (or should be) a straightforward way to address any given point in a
document. I'm fairly sure there isn't one. See
http://lists.w3.org/Archives/Public/www-xml-linking-comments/2000JulSep/0163.html,
in which I suggest adding a "points" axis to simplify this sort of
construction.
-Michael Dyck
Received on Wednesday, 17 January 2001 04:07:45 UTC