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

It seems that there are no XPath column/line Information functions.

But with Xalan, it seems that we can use the source location feature  
[1] that provide the SourceLocator.
With the SourceLocator, we can use the NodeInfo lineNumber Xalan  
function [2].
I try to use this direct in the XSLT at the command line, but I get  
always the error:
'There is more than one method matching the function call  
info:lineNumber, and there is insufficient type information to  
determine which one should be used'
Add the context or nodeList XPath, won't help, so it seems that there  
are problems with running this on the command-line.

Here my test XSLT:
-----------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:info="org.apache.xalan.lib.NodeInfo"
		extension-element-prefixes="info">

		<xsl:template match="/">
			<xsl:value-of select="info:lineNumber(node())"/>
		</xsl:template>
</xsl:stylesheet>

It is only a command line problem?
(I never used Xalan functions in XSLT before, but I noticed in the  
first CachingTest.xsl that Sean has used this - could someone help me  
at this problem?)

Another resolution could be Expat and GetCurrentColumnNumber /  
GetCurrentLineNumber, but using the Xalan Source Locator seems to be  
the preferred way.

  Roland


[1] http://xml.apache.org/xalan-j/features.html#source_location
[2] http://xml.apache.org/xalan-j/apidocs/org/apache/xalan/lib/ 
NodeInfo.html#lineNumber(org.apache.xalan.extensions.ExpressionContext)

Received on Monday, 18 June 2007 07:42:41 UTC