Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XALAN: ClassCastException: org.apache.xpath.objects.XString -- a bug?

Reply
Thread Tools

XALAN: ClassCastException: org.apache.xpath.objects.XString -- a bug?

 
 
Johannes Lebek
Guest
Posts: n/a
 
      07-09-2003
Hi there,

I made some changes to my XSL stylesheet and now Xalan 2.5.1 is facing
ClassCastExceptions. 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 ClassCastException 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.transform.TransformerException): java.lang.ClassCastExc
eption: org.apache.xpath.objects.XString

Line 558:
<xsl:value-of select="generate-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



 
Reply With Quote
 
 
 
 
Johannes Lebek
Guest
Posts: n/a
 
      07-09-2003
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
ClassCastException?

Johannes


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments