[xsl] Re: Is there a way to relate source tree nodes to result tree nodes?

Subject: [xsl] Re: Is there a way to relate source tree nodes to result tree nodes?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sat, 28 Jul 2001 12:16:54 -0700 (PDT)
David Penton wrote:

[snip]

> If I understand xslt correctly (which I would certainly not bet the ranch on), the
> identity of the
> nodes in the source DOM are lost to the xslt transform, and are available only as
> xslt tree objects.
> I would guess that this is so even if I get the result tree as a DOM 2 document, 
> in that the xslt
> transformer cooks up its own result DOM with no navigable relationship with the 
> source DOM.
> 
> I guess I might be able to figure out some way to use the position of elements in
> document order, or
> change the dtd so that elements have id attributes that I could navigate back to,
> or something.  But
> it would sure be nice to to have a simpler way to identify the node in the source
> DOM per se that I
> have at a given spot in the stylesheet.

One unique ID of a node is an XPath expression that returns exactly that node. Any
such expression remains constant unless the source xml has been changed.

A stylesheet producing an XPath expression for a node can be found at:

http://www.dpawson.co.uk/xsl/sect2/N6077.html#d176e20

or at

http://www.vbxml.com/snippetcentral/main.asp?view=viewsnippet&id=v20010323001030

Hope this helped.

Cheers,
Dimitre Novatchev.

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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


Current Thread