Hi, Malathi.
This looks like a bug in your stylesheets. Here's a fragment of the
rightNav template from rightNav.xsl
<xsl:template name="rightNav">
<xsl:param name="grps"/>
<xsl:param name="currentLink"/>
<table cellpadding="1" cellspacing="1" border="0" width="100%">
<xsl:for-each select="xalan:nodeset($grps)/Groups/Group" >
But the only call-template that refers to rightNav that I can see looks
like this (reformatted for readability):
<xsl:call-template name="rightNav">
<xsl:with-param name="grps"><xsl:value-of
select="$groups"/></xsl:with-param>
<xsl:with-param name="currentLink" select="$groupName"/>
</xsl:call-template>
Note that the xsl:value-of instruction constructs a text node whose value
is the string value of the "groups" variable. That variable is in turn an
xsl:param that appears to be defined like this:
<xsl:with-param name="groups" select="preceding-sibling::RightNav"/>
I see that the RightNav element in final.xml contains a Groups child, so I
think your xsl:call-template for rightNav was really supposed to look like
this:
<xsl:call-template name="rightNav">
<xsl:with-param name="grps" select="$groups"/>
<xsl:with-param name="currentLink" select="$groupName"/>
</xsl:call-template>
Doing that should allow you to remove the reference to the xalan:nodeset
extension function inside rightNav:
<xsl:template name="rightNav">
<xsl:param name="grps"/>
<xsl:param name="currentLink"/>
<table cellpadding="1" cellspacing="1" border="0" width="100%">
<xsl:for-each select="$grps/Groups/Group" >
I hope that helps.
Thanks,
Henry
------------------------------------------------------------------
Henry Zongaro
XML Transformation & Query Development
IBM Toronto Lab T/L 313-6044; Phone +1 905 413-6044
mailto:[EMAIL PROTECTED]
"Manivannan, Malathi" <[EMAIL PROTECTED]>
2008-05-08 12:03 PM
To
Henry Zongaro/Toronto/[EMAIL PROTECTED], Brian Minchau/Toronto/[EMAIL PROTECTED]
cc
"Muthiyan, Chittu" <[EMAIL PROTECTED]>,
<[email protected]>
Subject
RE: Xalan 2.7.1 class cast problem.
Henry/Brian – Thanks for your timely responses. After the below mentioned
changes, now I am not getting any errors. But it doesn’t resolve the
nodeset either. I am sending the 3 relevant files – final.xml,
GroupAce.xsl and rightNav.xsl. Please take a look at these and let me know
if I am missing something.
Thanks a bunch.
Malathi Manivannan
E-Configurator group
Tellabs, Naperville IL.
[EMAIL PROTECTED]
(630) 798-4072
From: Henry Zongaro [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 07, 2008 2:11 PM
To: Manivannan, Malathi
Cc: Brian Minchau; Muthiyan, Chittu; Java Girl;
[email protected]
Subject: RE: Xalan 2.7.1 class cast problem.
Hi, Malathi.
Sorry that I didn't notice this problem earlier. The name of the
Xalan-specific extension function is xalan:nodeset rather than
xalan:node-set. I believe that's why you're getting the
NoSuchMethodException. The following should work:
<xsl:for-each select="xalan:nodeset($grps)/Groups/Group">
Alternatively, for greatest portability, you might want to use the EXSLT
common node-set extension function:
<xsl:for-each select="common:node-set($grps)/Groups/Group" xmlns:common="
http://exslt.org/common">
I hope that helps.
Thanks,
Henry
------------------------------------------------------------------
Henry Zongaro
XML Transformation & Query Development
IBM Toronto Lab T/L 313-6044; Phone +1 905 413-6044
mailto:[EMAIL PROTECTED]
"Manivannan, Malathi" <[EMAIL PROTECTED]>
2008-05-07 12:05 PM
To
Henry Zongaro/Toronto/[EMAIL PROTECTED], Brian Minchau/Toronto/[EMAIL
PROTECTED]
cc
<[email protected]>, "Muthiyan, Chittu"
<[EMAIL PROTECTED]>, "Java Girl" <[EMAIL PROTECTED]>
Subject
RE: Xalan 2.7.1 class cast problem.
Brian/Henry – Any updates on this issue? We are stuck here as our
Application is planning to upgrade our Selectica Engine to 9.1, which has
Xalan 2.5. With Xalan 2.5, we were getting the error “Can not convert
#RTREEFRAG to a NodeList!” – so we tried moving to Xalan 2.7.1 – hence
then the below mentioned errors. Any help in this regard will be greatly
appreciated.
Thanks,
Malathi Manivannan
E-Configurator group
Tellabs, Naperville IL.
[EMAIL PROTECTED]
(630) 798-4072
From: Manivannan, Malathi
Sent: Monday, May 05, 2008 1:38 PM
To: 'Henry Zongaro'; Brian Minchau
Cc: [email protected]; Muthiyan, Chittu; 'Java Girl'
Subject: RE: Xalan 2.7.1 class cast problem.
Hi Henry -
The grps variable is result tree fragment – with multiple “Group” nodes
that I wan to traverse. Please see the attached xml –$grps refers to the
<RightNav> tree fragment. This was working until we decided to upgrade
Xalan (and also moved from JDK 1.4.2 to 1.5 )
I did try the change you suggested below, now I am getting the following
error.
org.apache.xml.utils.WrappedRuntimeException:
java.lang.NoSuchMethodException: For extension function, could not find
method org.apache.xalan.lib.Extensions.nodeSet([ExpressionContext,]
#STRING).
Checked both static and instance methods.
Thanks,
Malathi Manivannan
E-Configurator group
Tellabs, Naperville IL.
[EMAIL PROTECTED]
(630) 798-4072
----- Original Message ----
From: Henry Zongaro <[EMAIL PROTECTED]>
To: Java Girl <[EMAIL PROTECTED]>
Cc: [email protected]; Brian Minchau <[EMAIL PROTECTED]>
Sent: Monday, May 5, 2008 11:58:51 AM
Subject: Fw: Xalan 2.7.1 class cast problem.
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]
From: Java Girl [mailto:[EMAIL PROTECTED]
Sent: Monday, May 05, 2008 12:04 PM
To: Brian Minchau
Cc: [email protected]; Manivannan, Malathi; Muthiyan, Chittu
Subject: Re: Xalan 2.7.1 class cast problem.
Hi Brian - I have tried both - the Xalan interpreter and XSLTC(with
recomplied Stylesheet)..Still getting the same error..
~Latha (a) Malathi
----- Original Message ----
From: Brian Minchau <[EMAIL PROTECTED]>
To: Java Girl <[EMAIL PROTECTED]>
Cc: [email protected]
Sent: Monday, May 5, 2008 11:29:04 AM
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.
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
now.
============================================================
The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader
of this message is not the intended recipient, or an employee
or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any reproduction,
dissemination or distribution of this communication is strictly
prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and
deleting it from your computer. Thank you. Tellabs
============================================================
============================================================
The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader
of this message is not the intended recipient, or an employee
or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any reproduction,
dissemination or distribution of this communication is strictly
prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and
deleting it from your computer. Thank you. Tellabs
============================================================
[attachment "rightNav.xsl" deleted by Henry Zongaro/Toronto/IBM]
[attachment "final.xml" deleted by Henry Zongaro/Toronto/IBM] [attachment
"GroupAce.xsl" deleted by Henry Zongaro/Toronto/IBM]