xsl-list
[Top] [All Lists]

[xsl] Error Namespace 'java.io.File' does not contain any functions" (was Re: [xsl] XSL cant check if "File exists"?)

2006-08-31 15:22:43
Thanks Mike, David and Mukul, 
If you have to work client side, then you're stuck
with XSLT 1.0 for a
couple of years yet.

I am hearing the bottomline is that XSL (client side)
cannot gracefully check if a file exists for now.

But going back to my earlier question (which I am not
sure was answered), I read there is a way to check
using extensions, but the following
example gives me an error "Namespace 'java.io.File'
does not contain any functions" in IE and XML spy. It
works incorrectly in Firefox / Flock by always saying
the file does not exist (even if it does). Changing
XSLT 1.0 to 2.0 did not make any difference. Am I
missing something in the namespace declarations?

 If there is no way this can be gracfully done in XSL
(client side) then we might have to dump our work in
XSL and start looking for alternatives to XSL and I
hope the guru's have some solution.
Thanks,
-Tulaky
Example adapted from another posting:
------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:fn="http://www.w3.org/2005/02/xpath-functions";
xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes";
xmlns:xlink="http://www.w3.org/1999/xlink";
xmlns:h="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
<!-- my other templates go here which call this with
the Fully qualified or relative filename-->
<xsl:template name="file_exists"
xmlns:file="java.io.File">
  <xsl:param name="filename" />

  <xsl:if test="not(file:exists($filename))">
  file <xsl:value-of select="$filename"/> does not
exist!
  </xsl:if>
</xsl:template> 
</xsl:stylesheet>



------------------------------

Date: Wed, 30 Aug 2006 13:41:44 +0100
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
From: "Michael Kay" <mike(_at_)saxonica(_dot_)com>
Subject: RE: [xsl] Namespace
'http://www.w3.org/2005/xpath-functions' does not
contain any functions (was Re: [xsl] XSL cant check
if "File exists"?)
Message-ID: <00d801c6cc31$a69b3090$1a09010a(_at_)turtle>


 but IE says Namespace
'http://www.w3.org/2006/xpath-functions' does not
contain any 
functions.(tried both 2006 and 2005 in the fn
namespace 
declaration) Firefox says "Error during XSLT
transformation: 
An unknown XPath extension function was called."

In both cases, they are saying "I'm an XSLT 1.0
processor, I don't
understand anything about XSLT 2.0 functions".

If you have to work client side, then you're stuck
with XSLT 1.0 for a
couple of years yet.

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

------------------------------


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] Error Namespace 'java.io.File' does not contain any functions" (was Re: [xsl] XSL cant check if "File exists"?), Laky Tang <=