[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: File:New generates error

Subject: RE: File:New generates error
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 16 Mar 2009 12:52:10 -0000
RE:  File:New generates error
You're not using Saxon here, you're using the XSLTC processor (part of the
Xalan product). I suspect that's related to the the problem, since calling
conventions for extension functions depend on the processor you are using.

Since file:exists in Java returns a boolean, I would suggest taking out the
" = 'true'" part of the test, since comparing a boolean to a string is
somewhat error-prone.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Cool The Breezer [mailto:techcool.kumar@xxxxxxxxx] 
> Sent: 16 March 2009 12:18
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  File:New generates error
> 
> 
> Hi,
> We have strange error started coming recently for using java 
> A= PI to check file existence. Recently we moved to saxon and 
> earlier we were using Xalan but I dont think this caused the 
> error. We were using this code since years or so without any 
> problem and this error =A0comes randomly. I am not able to 
> replicate this in dev environment. I would appreciate your 
> help on finding root cause of this problem.
> 
> XSL Code:
> 
> <xsl:template name="file-exists" xmlns:file="java.io.File">
> 
> 		<xsl:param name="filename"/>
> 		<xsl:choose>
> 			<xsl:when 
> test="file:exists(file:new($filename)) = 'true'">true</xsl:when>
> 			<xsl:otherwise>false</xsl:otherwise>
> 		</xsl:choose>
> 	</xsl:template>
> 
> Error:
> ERROR:  'Cannot convert argument/return type in call to 
> method 'java.io.File.new(reference)''
> 
> FATAL ERROR:  'Could not compile stylesheet'
> 
>  
> 
> java.lang.ClassCastException: 
> com.sun.org.apache.xalan.internal.xsltc.compiler.Variable 
> cannot be cast to 
> com.sun.org.apache.xalan.internal.xsltc.compiler.Param
> 
>       at 
> com.sun.org.apache.xalan.internal.xsltc.compiler.SymbolTable.a
> ddParam(Unknown Source)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.