This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
=== Identifying a unique node in a DOM tree ===
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: === Identifying a unique node in a DOM tree ===
- From: Jonathan Asbell <jonathan dot asbell at raremedium dot com>
- Date: Tue, 30 May 2000 11:12:29 -0400
- Reply-To: xsl-list at mulberrytech dot com
If we are to make alterations to a dom tree, and xsl does not actually
identify a node by xpath in a dependable manner (see quote from xsl list
below), is there an XML or DOM implementaion that uniquely identifies a
node? The purpose is to NOT use a database, but instead a flat xml file and
be able to identify and edit a particular node.
QUOTE FROM SUBSCRIBER OF XSL-LIST
(In response to David Carlisle)
"Be aware that there is no nice way to locate a node by just giving
a path.
You /can/ construct a path from a node, but that path does NOT uniquely
identify that node gain.
You may have to take into account ordinal (array) positions before your
node path becomes definitive.
This puzzled me a bit when coming from web development. I figured an XML
node could be regarded as an extension of a filesystem path ... until I
tried impimenting it.
Although you probably understand what I mean if I was to indicate a path
like "http://my.xml.com/document.xml#/root/chapter/section", the fact is
that that notation CANNOT work.
Working backwards from Davids eg, you will see that it will have to be
something like document.xml#/root[0]/chapter[1]/section[1] before it
becomes meaningful.
This may be long-obvious for some on this list, but it blew me away when
I first got around to thinking about this limitation (or gotcha)
.dan.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list