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

Namespace 'http://www.w3.org/2005/xpath-functions' doe

Subject: Namespace 'http://www.w3.org/2005/xpath-functions' does not contain any functions (was Re: XSL cant check if "File exists"?)
From: Laky Tang <tulaky@xxxxxxxxx>
Date: Tue, 29 Aug 2006 14:04:16 -0700 (PDT)
xpath fn namespace
Thanks Mukul.
I did try
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2006/xpath-functions">
.........
		<xsl:if test="fn:doc-available($url)"><br /> da file
does not exists</xsl:if>
..........

 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."

Am I missing something in the headers or should I just
wait until the Candidate recommendation is implemented
by most tool vendors?
If so, is there an immediate solution for this (to
check if a file exists)?
Thanks again,
-Tulaky
------------
Date: Mon, 28 Aug 2006 14:28:58 +0530
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Subject: Re:  XSL cant check if "File exists"?
Message-ID: 
<7870f82e0608280158y191f54dcy9ae829ec63ca22ac@xxxxxxxxxxxxxx>

With XSLT 2.0, you can use the doc-available(string?
$uri) function.

On 8/28/06, Laky Tang <tulaky@xxxxxxxxx> wrote:
> I have followed various postings and I am led to
> believe that XSL does not have any built in
capability
> to check if a file exists or not. 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.
> I find it quite ironic that XSLT lacks this basic
> capability to check if a file exists-or-not given
its
> main use is in working with XML documents (and
files).
> If there is a simple way to gracefully handle the
> condition, can somebody please point me in the right
> direction?
> 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 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>

-- 
Regards,
Mukul Gandhi

http://gandhimukul.tripod.com

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



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

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-2011 All Rights Reserved.