473,804 Members | 2,280 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XALAN: ClassCastExcept ion: org.apache.xpat h.objects.XStri ng -- a bug?

Hi there,

I made some changes to my XSL stylesheet and now Xalan 2.5.1 is facing
ClassCastExcept ions. I'm pretty sure, that the changes I made should work
(they are quite complicated -- I'd like to not explain them here).

My question is, is a ClassCastExcept ion a usual response in case of an error
in a stylesheet or is this a bug? I thought, Xalan would handle exceptions
like this internally.

This is the error message I get:

file:///D:/XSLT/stylesheet.xsl; Line #558; Column #137; XSLT Error
(javax.xml.tran sform.Transform erException): java.lang.Class CastExc
eption: org.apache.xpat h.objects.XStri ng

Line 558:
<xsl:value-of select="generat e-id(//a[@b = $c/@d])"/>

Variable 'c' was defined just two lines above:
<xsl:value-of select="//e[@f = current()/parent::e/@h]"/>

Value of variable 'c' is always a single node. Even if I changed the
assignment to
<xsl:value-of select="//e[@f = current()/parent::e/@h][1]"/>
it did not help. (Please, note '[1]' at the end of the predicate!)

Usually, the error messages I got were something like "this or that is not
allowed" or "character ']' expected, but ')' found" or stuff like that. The
error message I got now is kinda "naked", like unhandled.

What do you think?

Johannes

Jul 20 '05 #1
1 8469
Fixed my problem:
Nodes should be assigned to variables using

<xsl:variable name="x" select="node()"/>

but not like that

<xsl:variable name="x">
<xsl:value-of select="node()"/>
<xsl:variable/>

But, nevertheless, there is still the question why Xalan is reporting a
ClassCastExcept ion?

Johannes
Jul 20 '05 #2

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

Similar topics

0
1492
by: Guillaume Jeudy | last post by:
Hi, I'm trying to serialize a DOM constructed from the following URL which is subject to change very frequently: http://www.bbc.co.uk/syndication/feeds/news/ukfs_news/world/asia-pacific/rss091.xml I sometimes receive this error: java.lang.NullPointerException:
0
1467
by: Volker Jordan | last post by:
Hi, has anyone a conclusion why the xalan xpath expressions dont work with the dom3 implementation from xerces ? I never get a result when the DOM is build via the lsparser. Has someone the xerces lsparser and xalan xapth in a running application ?
1
2310
by: Fisch von Gestern | last post by:
I have tried to run the extension function/element examples provided with the Xalan-J download. I believe that my classpath is correct, and that my versions are up-to-date. However, I can't get past the following error. Any help, please? =========================================================================== C:\xalan>test C:\xalan>REM @echo off
2
2219
by: littlefitzer | last post by:
Hi, I have come across a tricky little problem, I hope maybe one of you can help. The problem I am having is that I need to parse two seperate values from an XML document using XSL. The two elements however are identical in their names and XPath appearing as below in the XML (I have left out XPath as they are the same): <esb:AcctTypeCode>43</esb:AcctTypeCode> <esb:AcctTypeCode>21</esb:AcctTypeCode>
7
4130
by: RC | last post by:
First, let me say I couldn't find a group discuss XML/XSLT. So I only choose the closest groups to post this message. Here is part of my *.xsl file <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan" xmlns:my-javascript-ext="my-ext1" extension-element-prefixes="my-javascript-ext"
3
1845
by: Avalon1178 | last post by:
Hi, I recently downloaded the xalan-c source code in http://mirrors.ccs.neu.edu/Apache/dist/xml/xalan-c I followed the instructions from the apache site on how to build it (I already have xerces downloaded and compiled), however, I'm getting quite a few compile errors. I downloaded and compiled xerces 2.6.0 and I downloaded xalan 1.9.0.
2
2336
by: intrepidca | last post by:
When I try to translate an XML file (using org.apache.xalan.xslt.Process) that has a DOCTYPE declaration, I only get the <?xml ...?> processing instruction in the output file. I get no error messages. If I remove the DOCTYPE declaration it works fine. I have checked that the XML file is valid according to the DTD (using xmllint) and that checks out. Here are snippets from the XML and the XSL files and debugging output from xalan: the...
4
2224
by: duduch_1er | last post by:
Hello i tried this code in my stylesheet : xsl:variable name="items" select="xsl-usexsl:getElementsBySplitString(.,'i')" /> whith the java function getElementsBySplitString here the code : public static Element getElementsBySplitString(String aToSplit, String aSeparator) throws UseXslException {
2
2022
by: star111792 | last post by:
helo all, i am working with JSP and EJBs. i have written a simple code for verifying username and password of user by using session beans. my problem is that i m getting exception named "ClassCastException". Exception is as follows: type Exception report message
0
9714
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
10599
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
10346
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...
0
10090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7635
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
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
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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.