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

Re: reading a document into a typed variable

Subject: Re: reading a document into a typed variable
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 30 Sep 2009 16:52:42 +0100
Re:  reading a document into a typed variable
> I don't understand the difference between two ways of loading an XML 
> file into a variable (see A and B below). Case A used to work with old 
> saxon 8.9, but with 9.2 only B is successful.

I would expect B to fail in the case that the file is not there 
(If you have defined $global.setup.file) as in A

you then have effectively

 <xsl:variable name="global.setup"
 as="document-node(element(global-setup))">
    <xsl:copy-of select="$global.setup.file"/>
</xsl:variable>

and the type xs:string doesn't match document-node()


(A) is similar but being a single xpath expression it is perhaps easier
for the system to statically detect the type might be string, not sure.

> If I omit the type declaration in A, the rest of the stylesheet is 
> nevertheless working correctly. So at a certain stage, what saxon sees 
> as a xs:sting is converted into a tree.

If you use xsl:variable with emlement content but no as attribute it
always makes a document node with children the content of the
xsl:variable so

<xsl:variable name="global.setup"/>
   <xsl:copy-of select="trace($global.setup.file,'Configuration 
 File $global.setup.file was not readable (missing or not valid)!')"/>
</xsl:variable>

makes global.setup into a document node with a single text node child,
so it macthes document-node() but not of course
document-node(element(global-setup))


David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

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.