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

RE: doc-available vs. exists(document)

Subject: RE: doc-available vs. exists(document)
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 15 Jun 2009 23:26:51 +0100
RE:  doc-available  vs.  exists(document)
I think the issue is that your argument to document() is a node; document()
handles that situation specially and resolves the relative URI held in the
node against the base URI of that node, wherease doc-available() atomizes
the node and resolves its value against the base URI of the stylesheet
instruction. You need to use resolve-uri() explicitly to achieve matching
behaviour.

Regards,

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

> -----Original Message-----
> From: mlcook@xxxxxxxxxx [mailto:mlcook@xxxxxxxxxx]
> Sent: 15 June 2009 23:16
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  doc-available vs. exists(document)
>
> In the template below, I'm getting different results
> depending on which "when" test I use.
>
> If I use the exists(document($name)) test, it passes; but
> doc-available($name) fails.
>
> The input document is schema valid.
>
> The template is invoked with something like:
> <my-doc href="Initialization\Begin.xml"/>
>
> I thought I was using doc-available correctly, and it has
> worked fine in other situations.  I'd like to use
> doc-available to avoid the java error message about a file
> not found, and process the error condition myself.
>
> What am I overlooking?
>
> Thanks, Mike
>
>
>     <xsl:template match="my-doc">
>         <xsl:variable name="name" select="@href"/>
>         <xsl:choose>
>             <xsl:when test="exists(document($name))">
>             <!-- <xsl:when test="doc-available($name)"> -->
>                 <xsl:message>document is available</xsl:message>
>                 <xsl:apply-templates select="document($name)/*"/>
>             </xsl:when>
>             <xsl:otherwise>
>                 <xsl:message>document error</xsl:message>
>             </xsl:otherwise>
>         </xsl:choose>
>     </xsl:template>
>
>
> This email and any attachments are only for use by the
> intended recipient(s) and may contain legally privileged,
> confidential, proprietary or otherwise private information.
> Any unauthorized use, reproduction, dissemination,
> distribution or other disclosure of the contents of this
> e-mail or its attachments is strictly prohibited.  If you
> have received this email in error, please notify the sender
> immediately and delete the original.

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.