Subject: RE: ClassCastException
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Fri, 12 Dec 2003 11:26:57 -0000
|
A ClassCastException or any other kind of exception that causes a stack
trace like this, with no user extension functions involved, is prima
facie evidence of a bug in your XSLT processor and should be reported to
your supplier.
Michael Kay
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> alana@xxxxxxxxxx
> Sent: 11 December 2003 11:07
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: ClassCastException
>
>
> why do i get the exception.....the node.xsl file is pasted below
> **************************************************************
> **********************
> //XML
> <DATA>
> <component id="description_of_plates" type="question">
> <property id="label">
> <value>Description of Plates:</value>
> </property>
> <property id="help"/>
> <property id="tooltip"/>
> <property id="format">
> <value>textbox</value>
> </property>
> <property id="cid"></property>
> <component id="description_of_plates" type="answer">
> <property id="ans">
> <value></value>
> </property>
> </component>
> </component>
>
> </DATA>
>
>
> **************************************************************
> **********************
> //XSL
> <xsl:call-template name="getvalue2">
> <xsl:with-param name="nodew">
> /DATA/component/<xsl:value-of select="$reqnode"/>
> </xsl:with-param>
> <xsl:with-param name="selectid">ans</xsl:with-param>
> <xsl:with-param name="attr"><xsl:value-of
> select="."/></xsl:with-param> </xsl:call-template>
>
>
> <xsl:template name="getvalue2" >
> <xsl:param name="nodew"/>
> <xsl:param name="selectid"/>
> <xsl:param name="attr"/>
> <xsl:value-of select="$nodew"/>
> <xsl:call-template name="node:xpath">
> <xsl:with-param name="node" >
> <xsl:value-of select="$nodew"/>
> </xsl:with-param>
> </xsl:call-template>
> </xsl:template>
> **************************************************************
> **********************
>
>
> This code gives the following error
>
> java.lang.ClassCastException; SystemID:
> http://127.0.0.1:9999/liberty/xsl/node.xsl; Line#: 17;
> Column#: 61 javax.xml.transform.TransformerException:j
> ava.lang.ClassCastException at
> org.apache.xalan.transformer.TransformerImpl.executeChildTempl
> ates(Unknown Source) at
> org.apache.xalan.templates.ElemChoose.execute(Unknown Source)
> at
> org.apache.xalan.transformer.TransformerImpl.executeChildTempl
> ates(Unknown Source) at
> org.apache.xalan.templates.ElemTemplate.execute(Unknown
> Source) at
> org.apache.xalan.templates.ElemCallTemplate.execute(Unknown
> Source) at
> org.apache.xalan.transformer.TransformerImpl.executeChildTempl
> ates(Unknown Source) at
> org.apache.xalan.templates.ElemTemplate.execute(Unknown
> Source) at
> org.apache.xalan.templates.ElemCallTemplate.execute(Unknown
> Source) at
> org.apache.xalan.transformer.TransformerImpl.executeChildTempl
> ates(Unknown Source) at
> org.apache.xalan.templates.ElemLiteralResult.execute(Unknown
> Source) at
> org.apache.xalan.transformer.TransformerImpl.executeChildTempl
> ates(Unknown Source) at
> org.apache.xalan.templates.ElemLiteralResult.execute(Unknown
> Source) at org.apache.xalan.transformer.TransformerImpl!
> .executeChildTemplates(Unknown Source) at
> org.apache.xalan.templates.ElemLiteralResult.execute(Unknown
> Source) at
> org.apache.xalan.transformer.TransformerImpl.executeChildTempl
> ates(Unknown Source) at
> org.apache.xalan.transformer.TransformerImpl.applyTemplateToNo
> de(Unknown Source)
>
>
> **************************************************************
> ****************
> node.xsl
> <?xml version="1.0"?>
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:node="http://xsltsl.org/node"
> >
>
>
>
> <xsl:template name="node:xpath">
> <xsl:param name="node" select="."/>
>
> <xsl:choose>
>
> <xsl:when test="$node">
>
> <xsl:for-each select="$node[1]/ancestor-or-self::*">
> <xsl:text/>/<xsl:value-of select="name()"/>
> <xsl:text/>[<xsl:value-of
> select="count(preceding-sibling::*[name() = name(current())])
> + 1"/>]<xsl:text/>
> </xsl:for-each>
>
> <xsl:choose>
>
> <xsl:when test="$node[1]/self::comment()">
> <xsl:text>/comment()</xsl:text>
> <xsl:text/>[<xsl:value-of
> select="count($node[1]/preceding-sibling::comment()) + 1"
> />]<xsl:text/>
> </xsl:when>
>
> <xsl:when test="$node[1]/self::processing-instruction()">
> <xsl:text>/processing-instruction()</xsl:text>
> <xsl:text/>[<xsl:value-of
> select="count($node[1]/preceding-sibling::processing-instructi
> on()) + 1" />]<xsl:text/>
> </xsl:when>
>
> <xsl:when test="$node[1]/self::text()">
> <xsl:text>/text()</xsl:text>
> <xsl:text/>[<xsl:value-of
> select="count($node[1]/preceding-sibling::text()) + 1" />]<xsl:text/>
> </xsl:when>
>
> <xsl:when test="not($node[1]/..)">
> <xsl:text>/</xsl:text>
> </xsl:when>
>
> <xsl:when test="count($node[1]/../namespace::* |
> $node[1]) = count($node[1]/../namespace::*)">
> <xsl:text/>/namespace::<xsl:value-of
> select="name($node[1])" />
> </xsl:when>
>
> <xsl:when test="count($node[1]/../@* | $node[1]) =
> count($node[1]/../@*)">
> <xsl:text/>/@<xsl:value-of select="name($node[1])" />
> </xsl:when>
>
> </xsl:choose>
> </xsl:when>
>
> <xsl:otherwise>
> <xsl:text>/..</xsl:text>
> </xsl:otherwise>
>
> </xsl:choose>
>
> </xsl:template>
>
>
>
> <xsl:template name="node:type">
> <xsl:param name="node" select="."/>
>
> <xsl:choose>
> <xsl:when test="not($node)"/>
> <xsl:when test="$node[1]/self::*">
> <xsl:text>element</xsl:text>
> </xsl:when>
> <xsl:when test="$node[1]/self::text()">
> <xsl:text>text</xsl:text>
> </xsl:when>
> <xsl:when test="$node[1]/self::comment()">
> <xsl:text>comment</xsl:text>
> </xsl:when>
> <xsl:when test="$node[1]/self::processing-instruction()">
> <xsl:text>processing instruction</xsl:text>
> </xsl:when>
> <xsl:when test="not($node[1]/parent::*)">
> <xsl:text>root</xsl:text>
> </xsl:when>
> <xsl:when test="count($node[1] |
> $node[1]/../namespace::*) = count($node[1]/../namespace::*)">
> <xsl:text>namespace</xsl:text>
> </xsl:when>
> <xsl:when test="count($node[1] | $node[1]/../@*) =
> count($node[1]/../@*)">
> <xsl:text>attribute</xsl:text>
> </xsl:when>
> </xsl:choose>
> </xsl:template>
>
> </xsl:stylesheet>
> **************************************************************
> **************************************
>
> --
>
>
> MASTEK
> "Making a valuable difference"
> Mastek in NASSCOM's 'India Top 20' Software Service Exporters
> List. In the US, we're called MAJESCO
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the individual
> and not that of Mastek Limited, unless specifically indicated
> to that effect. Mastek Limited does not accept any
> responsibility or liability for it. This e-mail and
> attachments (if any) transmitted with it are confidential
> and/or privileged and solely for the use of the intended
> person or entity to which it is addressed. Any review,
> re-transmission, dissemination or other use of or taking of
> any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited.
> This e-mail and its attachments have been scanned for the
> presence of computer viruses. It is the responsibility of the
> recipient to run the virus check on e-mails and attachments
> before opening them. If you have received this e-mail in
> error, kindly delete this e-mail from all computers.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- ClassCastException
- alana - Thu, 11 Dec 2003 06:09:33 -0500 (EST)
- David Carlisle - Thu, 11 Dec 2003 06:53:40 -0500 (EST)
- Michael Kay - Fri, 12 Dec 2003 06:27:20 -0500 (EST) <=
- <Possible follow-ups>
- alana - Fri, 12 Dec 2003 00:41:15 -0500 (EST)
|
|