473,796 Members | 2,445 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 8466
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
2309
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
4126
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
1844
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
2223
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
9527
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10453
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
10223
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
10172
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
6785
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5441
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...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
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
3
2924
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.