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

Subject: [xsl] Is there a way to relate source tree nodes to result tree nodes?
From: dpenton@xxxxxxxxxxxxx
Date: Sat, 28 Jul 2001 14:12:30 -0400
I am using xslt to generate reports on problems within an xml document.  (The reported problems are
application-specific, and would not be noticed by a validating parser.)  I would like to be able to
navigate from a node in the result tree back to a related node in the source tree, so the user can
locate and fix the reported error.

More specifically, I receive the source tree as a DOM 2 document from the xml authoring tool
application (Epic) that calls my java code.  At the moment I generate a paper report using xslt.
The problem is that the reader of the report has no easy way of identifying the exact spots in the
original xml instance that caused my xslt transform to report errors.  The source document content
itself does not have "landmarks" in it that could be used to identify the problem elements.  What I
would like to do is display the report so that clicking on a "hyperlink" in my output report (using
some java widget or other on screen) would allow me to navigate back to the element that generated
that particular reported error.

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.

This post looks as clear as mud to me at the moment.  I hope that y'all catch the gist of it and can
help me out.

TIA.

David Penton
Arrowsash Inc.


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


Current Thread