Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 30th, 2006, 11:32 AM
Registered User
 
Join Date: Nov 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default ClassCastException

Hi I have following template which throws a classcast exception. What's wrong with it?
Code:
    <xsl:template name="Xform_status">
        <xsl:param name="source"/>
        <xsl:param name="in_status"/>        
        <xsl:variable name="css_status">
            <i ref="Completed">Confirmed</i>
            <i ref="Staffed">Confirmed</i>
            <i ref="Posted">Confirmed</i>
            <i ref="Confirmed">Confirmed</i>
            <i ref="Unscheduled">Canceled</i>
                </xsl:variable>
        <xsl:choose>
            <xsl:when test="$source='CSS'">
               <xsl:value-of select="$css_status[@ref=$in_status]"/>

            </xsl:when>

        </xsl:choose>        
    </xsl:template>
If I have the values in a separate file and use <xsl:value-of select="document('status.xml')/css_status/i[@ref=$in_status]"/>, it works fine.
thanks,

 
Old November 30th, 2006, 12:48 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If the ClassCastException occurs in the code of your XSLT processor then it's a bug and should be raised on the forum appropriate to the XSLT processor you are using.

Note however that your code is wrong, the $css_status variable is a document node containing a sequence of elements, you want

$css_status/i[@ref=$in_status]

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
java.lang.ClassCastException: org.apache.xpath.obj ksskumar XSLT 4 December 15th, 2006 03:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.