Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 81925

Summary: add nodes' XPath
Product: z_Archived Reporter: Zohar Amir <david_fire4>
Component: WTP IncubatorAssignee: Doug <doug.satchwell>
Status: RESOLVED FIXED QA Contact: David Williams <david_williams>
Severity: enhancement    
Priority: P3 CC: david_williams, doug.satchwell, d_a_carver, thatnitind
Version: unspecifiedKeywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Zohar Amir CLA 2004-12-27 05:41:38 EST
add a node's XPath to its properties
Comment 1 Craig Salter CLA 2005-01-10 00:05:10 EST
I'm assuming you'd like us to contruct a 'representative' XPath for the node.  
Can you add som more information about the use case you have in mind and how 
this information would be helpful?  I'd like to know how this enhancements fits 
into the big picture of what you're trying to accomplish.  

Thanks for your help!
Comment 2 Zohar Amir CLA 2005-01-10 01:43:42 EST
I need the XPath mainly to communicate with other software and people. For
example, if I have a non-trivial document and I want to say something about a
certain node (e.g., it holds a wrong value), I would like to do that in an
unequivocal manner.
Comment 3 Greg Knittl CLA 2005-03-08 19:01:20 EST
(In reply to comment #0)
> add a node's XPath to its properties

this could also be handy when writing XQueries or XSL Transforms on the XML file
Comment 4 Steen Lehmann CLA 2005-03-16 06:51:36 EST
Is a node's properties really a good place to put an XPath? In many cases it
could work, but in documents that use the default namespace you cannot create a
"nice" XPath to a node and is left with something that would look like
"/*[local-name()='root']/*[local-name()='a']/*[local-name()='b']" which is
verbose and ugly - or "/*[1]/*[2]/*[1]" which is probably not that helpful
either. This is due to the fact that in XPath, a prefix-less node name such as
/a always means the node must be in no namespace.

Perhaps a separate view for XPath support would be in order - for example, what
is an appropriate namespace context to use - the namespaces in scope for the
node, or the ones in scope for the document element? It depends on the use case,
and in a view you could have a mechanism to set or alter the namespace context.

The same goes for the context node - in XSLT, for example, you will typically
want an XPath from your current evaluation context to some selected node,
instead of an absolute path. You could set or change the context node if it was
a separate view.
Comment 5 Nitin Dahyabhai CLA 2007-09-13 03:15:24 EDT
Setting as help wanted.  Unless this is covered by the incubating XSLT enhancements, we won't have time to work on it just now.
Comment 6 Doug CLA 2008-03-03 14:50:21 EST
Actually, I have created an XPath view that displays the current document location e.g. if you click on a particular element in the XML editor, the view displays (one of the) xpaths to that node e.g. /root/to/my[3]/node - is this enough?
Comment 7 Zohar Amir CLA 2008-03-04 01:45:47 EST
Yep, sounds good (at least to me). Do you have any screen shots or anything?

Comment 8 Doug CLA 2008-03-07 07:33:54 EST
I think the best thing to do is wait for Ganymede M6 to arrive and download the M6 version of XSL from http://www.eclipse.org/webtools/incubator/downloads/
M6 should be in about 6 weeks time I think.
Comment 9 David Carver CLA 2008-03-19 14:36:50 EDT
I suggest moving this to the XSL Incubator project.   The XPath View and XPath Navigators that Doug mentions are available in 0.5M5 of the xsl tooling project.  You can download a zip from:

http://www.eclipse.org/webtools/incubator

The next milestone is scheduled for April 7th.
Comment 10 David Carver CLA 2008-04-16 08:22:36 EDT
Zohr and Steen have you checked out the XSL Tooling incubator project.  It includes an XPath view, that is linked to the XML Editor.   It will show you what the XPath is for the current cursor position.

Comment 11 Zohar Amir CLA 2008-04-21 09:31:03 EDT
Looks good.
1. Is there some explanation on how to work with this feature?
2. Whene standing on an attribute the xpath is not shown (the enclosing element's xpath is shown for a brief moment and then disappears) - is that a bug?
Comment 12 David Carver CLA 2008-04-21 10:41:21 EDT
(In reply to comment #11)
> Looks good.
> 1. Is there some explanation on how to work with this feature?

That is currently being developed.


> 2. Whene standing on an attribute the xpath is not shown (the enclosing
> element's xpath is shown for a brief moment and then disappears) - is that a
> bug?

Probably a bug, if you can please open a separate bug report for this.




Comment 13 Doug CLA 2008-04-23 03:22:49 EDT
Have fixed the bug with attribute nodes.
Comment 14 Zohar Amir CLA 2008-04-23 04:15:01 EDT
Thanks again.
Where can I download the fix?
Comment 15 David Carver CLA 2008-04-23 08:11:56 EDT
(In reply to comment #14)
> Thanks again.
> Where can I download the fix?
> 

It'll be available in our next Milestone release. Which is tentatively planned for May 7th.  Unfortunately we don't currently have a public weekly integration site yet.


Comment 16 David Carver CLA 2008-04-30 19:18:50 EDT
Verfied in latest IBuild20080430.   Zohar, please check 0.5M7 when it is available in a couple of weeks.  Marking this as resolved.