tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Boynes <jboy...@apache.org>
Subject [taglibs] XPath support
Date Fri, 09 Jul 2010 19:51:20 GMT
In light of the performance issues logged against the XML taglib and functional issues like
#49578, I was looking at refactor the XML tags to use the JAXP XPath API to pre-compile expressions
and dynamically resolve variables. I think this can be done fairly easily and will eliminate
a lot of the integration code in XPathUtil. However, I could not see how to expose the full
iteration context described in the spec for <x:forEach>:

* the context position is the iteration 'count' (with the same meaning as in <c:forEach>)
* the context size is equal to the number of nodes in the node-set over which <x:forEach>
is iterating

It looks like the current implementation does not support this:
	https://issues.apache.org/bugzilla/show_bug.cgi?id=22765
and in testing these functions always return -1 and 0 respectively.

Presumably these should be returned by the XPath core functions position() and last() respectively.
However, the JAXP API only allows a single Node to be passed in for evaluation and I could
not see a way to provide the context needed by these functions. I think this might be a limitation
of JAXP.

I plan to go ahead with the refactor as I think by simplifying our implementation we will
address the current performance issues and fix some of the functional edge cases. It will
also remove the hard dependency on the Xalan implementation.The iteration context functions
will remain broken consistent with the current implementation.

It might be possible to make this work using the low-level internal Xalan APIs as this functionality
is supported in Xalan's XSLT processing. To support this in the future, I'll try to make the
XPath usage pluggable so we can drop in a Xalan-specific version in the future.

Thoughts?
Jeremy


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message