[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: === Identifying a unique node in a DOM tree ===

Subject: Re: === Identifying a unique node in a DOM tree ===
From: "Khalid Asad" <asad@xxxxxxxxxxxxx>
Date: Tue, 30 May 2000 14:30:55 -0400
xpath unique nodes
It is possible to specify an XPATH uniquely enough to return one node (at
least with my experience). Sometimes you have to specify an index, for
example

<doc>
  <name first="Paul" last="Dick"/>
  <empty/>
  <name first="Robert" last="Weir"/>
  <name first="Scott" last="Boag"/>
  <empty/>
  <name first="Shane" last="Curcuru"/>
</doc>

If you have an xapth = '/doc/name[4]/@first'  you will get the 'first'
attribute node of the 4th 'name' element. You can refer to this node to
update the original document.

Khalid


----- Original Message -----
From: "Kevin Williams" <Kevin.Williams@xxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxx>
Sent: Tuesday, May 30, 2000 12:45 PM
Subject: RE: === Identifying a unique node in a DOM tree ===


> > 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.
>
> I'm not sure what you're asking for here - the DOM, in general, allows the
> programmer to operate on individual nodes. XSLT, on the other hand, is
> designed to operate on node sets (which may or may not consist of a single
> node). If you need some way of identifying the nodes, you can use the
> generate-id function in XPath - but I'm not sure that addresses your
> problem.
>
> > 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.
>
> Only in the sense that a (hypothetical) construct like
>
> c:/documents/root*/chapter*/section*
>
> doesn't work - there's no way to guarantee that the expression only
returns
> one node (although it might, or it might return no nodes at all). One of
the
> nice things about XPointer (IMO) is that you can use it to point to more
> than one node - you could use it, for example, to embed all the
interesting
> content from one document in another document without needing to reference
> it node-by-node.
>
> - Kevin
>
> Kevin Williams
> XML Architect
> Ultraprise Corporation
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.