[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] reading a document into a typed variable


Subject: Re: [xsl] reading a document into a typed variable
From: Georges Schmitz <georges.schmitz@xxxxxxxxx>
Date: Wed, 30 Sep 2009 18:53:15 +0200

Thanks for your prompt answer.

By using a *wrong* filename I get with method A and B and saxon 8.9 following output:

   Configuration File $global.setup.file was not readable (missing or
   not valid)! [1]: xs:string:
   file:///D:/Empic/workspace/EmpicSuite-trunk/empic-suite/resources/xml-resolved/GlobalSetup-resolved.xmlx
   Error on line 52 of
   file:/D:/Empic/workspace/EmpicSuite-trunk/empic-suite/script/xsl-functions/profile-filter.xsl:
     XTTE0570: Required item type of value of variable $global.setup is
     document-node(element(global-setup)); supplied value has item type
   xs:string


And with saxon 9.2


   Error at xsl:variable on line 52 column 212 of profile-filter.xsl:
     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

With a *correct* filename, neither A nor B work at all with 9.2, but with 8.9.

(it could be that I cited a wrong test in my former mail and B was also never working with saxon 9.2. Don't know where I made my changes with adding and dropping the "as" attribute, but always with respect that the same parameter content is provided in $global.setup.file).


David Carlisle wrote:
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()

I think you got me wrong here. I'm actually using the document function for reading.
<xsl:copy-of select="document($global.setup.file)"/>


What will be the conclusion? Omit the "as" attribute completely?

Georges
**********************************************************************************************
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
Keywords
xml