473,785 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ 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 TransformerConf igurationExcept ion saying that there was an
error while checking the type of the expression "funcall(en code-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 2299
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.setPrope rty("javax.xml. transform.Trans formerFactory",
"net.sf.saxon.T ransformerFacto ryImpl");

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
5067
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 in HTML DOM element names are all upper-case, whereas in Core DOM (used for the XHTML documents) element names are lower-case. When I use a lower-case xpath, e.g. /head
4
21210
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 native English speaker, it's quite hard to make the problem clear. Please see the following example.
0
1263
by: Bloody Viking | last post by:
I'm using a variation on Donald Leslie's JAXPTransletMultipleTransformations.java (http://www.cs.helsinki.fi/group/xmltools/formatters/xalan/xalan-j_2_1_0/samples/translets/JAXPTransletMultipleTransformations.java), and it seems to work just fine. But then I copied it, the xml and the xslt over to another machine (both SPARC boxes) and got a strange result: character entities are getting translated strangely. For instance, &ecirc; is...
0
1462
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 it mean that only JAXP 1.1 can be used (and therefore the latest Xerces and Xalan releases are forbidden, because JAXP 1.2 compliant), or with the famous "Endorsed Standards Override Mechanism"...
1
1239
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" encoding="UTF-8"?>
0
1246
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 Document fields; Directories,and FileList, that are populated as below;
18
7739
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); System.out.println(xp.evaluate(new InputSource(new FileInputStream("a.xml"))));
2
2074
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 data the XPath is pointing to. I think SelectSingleNode is the function I'm looking to use, butI'm not sure at all. I'm new to XML and Xalan and could use a little help getting on my way. Any ideas? Thanks for the help.
0
1419
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
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10346
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10096
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8982
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5386
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.