You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Mike Engelhart <me...@earthtrip.com> on 2000/07/05 19:56:53 UTC

XPath from Node

Does anyone have any sample code that would return a valid XPath from an
abitrary node.  What I'm trying to do is walk a DOM and return an XPath at
every node. 
I've managed to fail miserably at attempting this :-)

Thanks,
Mike


Re: XPath from Node

Posted by Brian Hüttner <ti...@Informatik.Uni-Bremen.DE>.
Hey,

Mike Engelhart schrieb:
> 
> Does anyone have any sample code that would return a valid XPath from an
> abitrary node.  What I'm trying to do is walk a DOM and return an XPath at
> every node.
> I've managed to fail miserably at attempting this :-)

I am working on a project where we face the same problem. Our
solution is to walk through the DOM and getting the XPath with
the node() function, i.e. 
	<element>
		<test>foo</test>
	</element>
would be (if element is the first element in the dcoument):
- element	/child::node()[1]
- test		/child::node()[1]/child::node()[1]
- text foo	/child::node()[1]/child::node()[1]/child::node()[1]

But be careful with attributes because attributes won't be matched
by the node() function. Get them with .../attribute::*[]

Hope this helps.

Best regards Brian
-- 
+--------------------------------------------------------+
| Brian Hüttner                   University of Bremen   |
| tim@informatik.uni-bremen.de    FB3 - Computer Science |
+--------------------------------------------------------+

XalanC format-number() and redirect extension?

Posted by David Braaten <da...@multiactive.com>.
Will anyone be doing any work on the format-number function or the redirect
extension
anytime soon?

I can work around not having the redirect extension for my project, but the
format number is
required.

If no one is planning to work on format-number, I suppose I will have to do
something with it myself...

tia