Re: === Identifying a unique node in a DOM tree ===
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/@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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format