[xsl] extract xpath locator

Subject: [xsl] extract xpath locator
From: Nicolas Mazziotta <nicolas.mazziotta@xxxxxxxxx>
Date: Wed, 11 Aug 2004 15:25:47 +0200
Hello,

I would like to write template that returns the exact xpath expression that locates a tag in mixed-content documents.

eg, i have:

<doc>
	This <i>is</i> a <b>T</b>est
</doc>

and I would like to get 

the Xpath that says that "i" includes char 6 and 7, and	"b"  char 11 of "/doc"

Besides, it should handle complex nesting like

<doc>
	This <i>i<b>s</b></i> a <b><i>T</i></b>est
</doc>

So that I can write an xpath such as substring(/doc/text(),6,2) to point on a bare sentence

<doc>
	This is a Test
</doc>

and know that "is" is labeled as "i"

I messed a bit with "substring", "string-length", etc. but could not figure out how to get the offset of the opening tag...


Any idea?

Thanks in advance


Nicolas Mazziotta

Current Thread