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

reading a document into a typed variable

Subject: reading a document into a typed variable
From: Georges Schmitz <georges.schmitz@xxxxxxxxx>
Date: Wed, 30 Sep 2009 17:37:18 +0200
 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. With A I get following error message:

XTTE0570: Required item type of value of variable $global.setup is
document-node(element(global-setup, xs:anyType)); supplied value has item type xs:string


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.

It's OK with me if you just point me to the right documentation to find out myself.

Thanks for clarification,
Georges

[A]
<xsl:param name="global.setup.file" select="'../../xml-resolved/GlobalSetup-resolved.xml'" as="xs:string"/>
<xsl:variable name="global.setup" select="if (doc-available($global.setup.file))
then document($global.setup.file)
else trace($global.setup.file,'Configuration File $global.setup.file was not readable (missing or not valid)!')" as="document-node(element(global-setup))"/>

[B]

<xsl:variable name="global.setup" as="document-node(element(global-setup))">
<xsl:choose>
<xsl:when test="doc-available($global.setup.file)">
<xsl:copy-of select="document($global.setup.file)"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="trace($global.setup.file,'Configuration File $global.setup.file was not readable (missing or not valid)!')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
**********************************************************************************************
IMPORTANT NOTICE / WICHTIGER HINWEIS
This communication contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any distribution, copying or use of this communication or the information in it is strictly prohibited. If you have received this communication in error please notify us immediately by email or by telephone and then delete this email and any copies of it.
Diese E-Mail koennte vertrauliche und/oder rechtlich geschuetzte Informationen enthalten. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.


HEITEC AG, Werner-von-Siemens-Str. 61, 91052 Erlangen, HRB 7754, RG Fuerth, Vorstandsvorsitzender: Richard Heindl, Vorstand: Harald Preiml, Finanzvorstand: Rene-Oliver Rosner, Aufsichtsratsvorsitzender: Dr. Lorenz M. Raith, WWW: http://www.heitec.de

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.