You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by "Karr, David" <da...@wamu.net> on 2005/11/03 01:36:06 UTC
Stylesheet to call "function-available" on string value dies with "Unknown error in Xpath" in xalan 2.4.1
I wrote a small stylesheet that just calls "function-available" on
values parsed from an XML file. I tested it in Stylus Studio, using
both Xalan-j 2.5.2 and Saxon 8.4. I then ran it from the command line
using JDK 1.4.2 (which uses Xalan-j 2.4.1. This time I get a "Unknown
error in Xpath" exception, with the following stack trace (truncated):
---------------
; SystemID:
file:///C:/cygwin/home/u166705/work/mfxslt/etc/functionAvailable.xsl;
Line#: 20; Column#: 47
javax.xml.transform.TransformerException: Unknown error in XPath.
at org.apache.xpath.XPath.bool(XPath.java:412)
at
org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:170)
at
org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(Ele
mApplyTemplates.java:425)
at
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates
.java:216)
at
org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(Ele
mApplyTemplates.java:425)
at
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates
.java:216)
[deleted]
Caused by: java.lang.NullPointerException
at
org.apache.xalan.transformer.TransformerImpl.functionAvailable(Transform
erImpl.java:448)
at
org.apache.xpath.functions.FuncExtFunctionAvailable.execute(FuncExtFunct
ionAvailable.java:130)
at org.apache.xpath.Expression.bool(Expression.java:230)
at org.apache.xpath.XPath.bool(XPath.java:383)
... 14 more
---------------
The stylesheet is just:
---------------
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:dyn="http://exslt.org/dynamic"
xmlns:func="http://exslt.org/functions"
xmlns:math="http://exslt.org/math"
xmlns:random="http://exslt.org/random"
xmlns:regexp="http://exslt.org/regular-expressions"
xmlns:set="http://exslt.org/sets"
xmlns:str="http://exslt.org/strings"
extension-element-prefixes="exsl str
date dyn func math random regexp set str"
exclude-result-prefixes="exsl str date
dyn func math random regexp set str"
>
<xsl:output method="xml"/>
<xsl:template match="function">
<xsl:choose>
<xsl:when test="function-available(text())">
<xsl:value-of select="text()"/> present
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="text()"/> not present
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
---------------
The data looks like:
---------------
<?xml version="1.0"?>
<functions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="file:///c:/cygwin/home/u166705/work/mfxsl
t/etc/Functions.xsd">
<function>date:add</function>
<function>date:add-duration</function>
<function>date:date</function>
[deleted]
</functions>
---------------
Re: Stylesheet to call "function-available" on string value dies with "Unknown
error in Xpath" in xalan 2.4.1
Posted by Henry Zongaro <zo...@ca.ibm.com>.
Hi, David.
"Karr, David" <da...@wamu.net> wrote on 2005-11-02 07:36:06 PM:
> I wrote a small stylesheet that just calls "function-available" on
> values parsed from an XML file. I tested it in Stylus Studio, using
> both Xalan-j 2.5.2 and Saxon 8.4. I then ran it from the command line
> using JDK 1.4.2 (which uses Xalan-j 2.4.1. This time I get a "Unknown
> error in Xpath" exception, with the following stack trace (truncated):
I tried your sample stylesheet, and I get the same "Unknown error in
XPath" message using the interpretive processor for all releases of
Xalan-J from 2.4.0 through to 2.7.0, which is the most recent. I'm not
sure why you wouldn't have seen the error in Stylus Studio using Xalan-J
2.5.2.
I'm not sure off-hand what triggers the problem or whether it's
possible to work around it. Could I ask you to open bug report in Jira
for this problem?
Thanks,
Henry
------------------------------------------------------------------
Henry Zongaro Xalan development
IBM SWS Toronto Lab T/L 969-6044; Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com