Subject: [xsl] Error Namespace 'java.io.File' does not contain any functions" (was Re: [xsl] XSL cant check if "File exists"?) From: Laky Tang <tulaky@xxxxxxxxx> Date: Thu, 31 Aug 2006 14:50:51 -0700 (PDT) |
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@xxxxxxxxxxxxxxxxxxxxxx> > From: "Michael Kay" <mike@xxxxxxxxxxxx> > 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@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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Outputting newline to XSL, cknell | Thread | [xsl] generate xpath expression in , David Murphy |
Re: [xsl] Retrieving top-level attr, Bob Portnell | Date | Re: [xsl] Transforming XML document, Tom Sawyer |
Month |