Hi, Malathi.

What does the definition of the grps variable look like?   The usual 
reason for this sort of error is that a result-tree fragment is being used 
in a context where a node set was expected.  That's not permitted 
according to section 11.1 of XSLT 1.0,[1] so an operation like 
$grps/Groups/Group would not be permitted if the value of grps was a 
result-tree fragment.

The node-set extension function allows you to tree a result-tree fragment 
as a node set, but in your example, you've made the argument to node-set 
be the result of the path expression, instead of applying it to the value 
of grps itself.

Try changing this

<xsl:for-each select="xalan:node-set($grps/Groups/Group)"> 

to this

<xsl:for-each select="xalan:node-set($grps)/Groups/Group"> 

I hope that helps.

Thanks,

Henry
[1] http://www.w3.org/TR/xslt#section-Result-Tree-Fragments
------------------------------------------------------------------
Henry Zongaro
XML Transformation & Query Development
IBM Toronto Lab   T/L 313-6044;  Phone +1 905 413-6044
mailto:[EMAIL PROTECTED]
----- Forwarded by Henry Zongaro/Toronto/IBM on 2008-05-05 12:52 PM -----

Brian Minchau/Toronto/[EMAIL PROTECTED] 
2008-05-05 12:29 PM

To
Java Girl <[EMAIL PROTECTED]>
cc
xalan-j-users@xml.apache.org
Subject
Xalan 2.7.1 class cast problem.






Hi Latha.
Looking at the class hierarchy, it does indeed look as though XNodeSet 
extends NodeSequence which extends XObject.

XString extends XObject. So for 2.7.1 this casting is never right. Are you 
running the Xalan interpreter, or XSLTC? If XSLTC, did you recompile your 
stylesheet?

- Brian

Java Girl <[EMAIL PROTECTED]>


Java Girl <[EMAIL PROTECTED]> 
05/02/2008 02:49 PM



To

[EMAIL PROTECTED]

cc

Latha Mani <[EMAIL PROTECTED]>

Subject

Fw: XSLT 1.0





Brian - Would you be able to help me with this?

I just upgraded from Xalan 2.4.1 to Xalan 2.7.1. Now I am getting "
java.lang.ClassCastException: org.apache.xpath.objects.XString cannot be 
cast to org.apache.xpath.objects.XNodeSet " in the below line - I love the 
way the error points to the exact line number of the xslt :)

I tried converting my xslt from 

<xsl:for-each select="$grps/Groups/Group"> 
to 
<xsl:for-each select="xalan:node-set($grps/Groups/Group)"> 
But I still get the same error. Any suggestions? 
Thanks, 
~Malathi

Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it 
now.

Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it 
now.

<<image/gif>>

<<image/gif>>

<<image/gif>>

<<image/gif>>

<<image/gif>>

<<image/gif>>

<<image/gif>>

<<image/gif>>

<<image/gif>>

<<image/gif>>

Reply via email to