Re: ACTION-512 - Research getting line and column information from XPath

> 1) Does this work in Java, not just XSLT? remember we do have some
> Java code here too. :)
I'm _outside_ the Java code, so please stop me if its getting to big :)

> 2) Are we really sure we won't need any XSLT 2.0? seems like we're
> doing so much in XSLT that we'd want all the features we can get. Like
> the ones we were already using!
I can downgrade the current implementations (outside Java, inside XSLT).

> 3) Saxon also already supports line numbers in a very similar way.
Yes:
<xsl:value-of select="saxon:line-number(.)" xmlns:saxon="http:// 
saxon.sf.net/"/>
with using  -l at the command-line works!

But most of the mobile pages try to avoid spaces and CR/LF - so the  
source document has only one line.

> I'm pretty sure we can get line/col info into the DOM itself using
> Xerces. Well, we're trying that now. Accessing it is just a matter of
> downcasting nodes and accessing Xerces-specific methods, which
> *should* work in XSLT too. Again, to be tried.

After thinking a bit more at returning line and column direct from XSLT,
I think we need more than only the Saxon line-number() or Xerces  
function.

The document we transform with the XSLT is the moki document,
so we will get the position in the moki document.
We can return the URI (or internal ID) and (original) XPath and solve  
this in a separate process,
or call an own function with the URI and XPath that get the line and  
column information from the original document.

So... only XSLT (1.0 or 2.0) will not solve this problem, there is  
Java code needed (and you know - I'm not the Java guy).
Maybe with a small XSLT (and a Xerces process?),
where the XSLT gets the XPath dynamic from the function and the  
source document represented by the URI.

  Roland

Received on Tuesday, 19 June 2007 06:20:06 UTC