473,484 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XPath data types / JAXP / Xalan

Hi there,

I'm having a problem compiling an XSL-stylesheet using JAXP/Xalan which is
really driving me nuts...

When I try to compile a stylesheet that contains something like:

<xsl:value-of select="encode-for-uri(/bla)"/>

then I get a TransformerConfigurationException saying that there was an
error while checking the type of the expression "funcall(encode-for-uri
....)". I don't know the exact error message, as the message I get is in
German for some reason (literally it says "Fehler beim Überprüfen des Typs
des Ausdrucks").

I suppose that the reason for this is that encode-for-uri() returns an
xs:string and @select expects a node-set, and it cannot convert between the
two. Or it is having a problem with the xs:string type in general, since it
does not say something like "cannot cast xs:string to whatever".

If anybody knows how to solve this problem, please let me know, as I've
already spent a few hours on this and I'm really frustrated ;-).

Regards,

Felix
Apr 17 '06 #1
2 2284
Well, the German message translates as "Error when examining the type of
the expression" ... less than completely helpful. <sigh/>

I believe encode-for-uri() isn't defined until XSLT 2.0; since Xalan's
still a 1.0 processor it doesn't provide this function.

I think your available answers are to either make an external function
call to your own implementation of this function, or to implement
equivalent behavior as a named template, or to count on the fact that if
you tell the system to output HTML it will ensure that HTML attributes
which are URI references get encoded as such.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Apr 17 '06 #2
> I believe encode-for-uri() isn't defined until XSLT 2.0; since Xalan's
still a 1.0 processor it doesn't provide this function.


Thanks a lot for your hint, it was quite helpful in finding the following
solution:

The problem was that Xalan does not support XSLT 2.0 nor XPath 2.0 (though
it seems to support some of the 2.0 features and does not complain about the
stylesheet being declared as 2.0). So I just switched to Saxon. In order to
tell JAXP to use Saxon instead of Xalan for transformation, I just had to
insert the following line into my initialization code (and include the Saxon
libraries in my classpath, of course):

System.setProperty("javax.xml.transform.Transforme rFactory",
"net.sf.saxon.TransformerFactoryImpl");

Surprisingly, it was pretty hard to find this information on the web... The
Saxon documentation states that normally this shouldn't be necessary, but
obviously it was for my web app on Tomcat.

Best regards,

Felix
Apr 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5046
by: Johannes Koch | last post by:
Hi there, I'd like to apply an xpath to both HTML and XHTML documents. First I create a DOM document with a Java DOM parser, then apply the xpath with Xalan's XPathAPI class. The problem is that...
4
21181
by: Son KwonNam | last post by:
In XSLT, is this possible to get value from xml using XPath which is in XSLT variable? I mean XPath strings can be dynamic while XSL Transforming. If possible, How?? Because I'm not a...
0
1243
by: Bloody Viking | last post by:
I'm using a variation on Donald Leslie's JAXPTransletMultipleTransformations.java...
0
1436
by: benoit | last post by:
Hi, When it's written in WebLogic Server 8.1 documentation that this software is based on JDK 1.4.1, and is JAXP 1.1 compliant, (http://edocs.bea.com/wls/docs81/xml/xml_intro.html#189256), does...
1
1227
by: gimme_this_gimme_that | last post by:
I have the following xml file and need some tips on xpath queries to fetch the data. I think I'm not handling namespaces correctly. Here is xml file : <?xml version="1.0"...
0
1230
by: Jeff Higgins | last post by:
Hi all Newbie to XPath. Can someone help with an XPath expression(s) that will accomplish the following using JAXP in J2SE-1.5. Thanks Jeff Higgins In a class I have two private org.w3c.dom...
18
7700
by: jacksu | last post by:
I have a simple program to run xpath with xerces 1_2_7 XPathFactory factory = XPathFactory.newInstance(); XPath xPath = factory.newXPath(); XPathExpression xp = xPath.compile(strXpr);...
2
2057
by: MV84 | last post by:
Does anyone know how to use the Xalan-C API to get data from an XML file using an XPath. I know the SimpleXPathCAPI inputs an XPath, but it only returns true and false - I want it to return the...
0
1395
by: jimmy Zhang | last post by:
VTD-XML (http://vtd-xml.sf.net) may also be interesting to you "Martin Honnen" <mahotrash@yahoo.dewrote in message news:47cd3ee6$0$25510$9b4e6d93@newsspool1.arcor-online.net...
0
7083
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6954
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7106
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5407
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4848
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4531
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3047
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
592
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
237
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.