RE: [xsl] XSLT 2.0 empty string

Subject: RE: [xsl] XSLT 2.0 empty string
From: "Pawson, David" <David.Pawson@xxxxxxxxxxx>
Date: Mon, 28 Feb 2005 15:47:09 -0000
    -----Original Message-----
    From: Michael Kay
    The variable was defined as:

    <xsl:variable name="foo" select="nothing" as="xs:string?"/>

    The select expression yields a node-sequence, the as
    expression requires atomic values, so XSLT invokes
    atomization. The result of atomizing an empty node-sequence
    is an empty sequence of strings.
    >
    > But I think it's true to say that as="xs:string" does
    _not_ force an
    > empty sequence to coerce to an empty string, isn't it?

    The only conversions forced by the "as" attribute are
    atomization and numeric promotion (e.g. int to double). It
    doesn't cause a cast. If the "as"
    attribute had said "xs:string" rather than "xs:string?", a
    type error would be reported.

Is the error XT0570?

[ERR XT0570] It is a type error if the supplied value of a variable cannot be
converted to the required type.

How should we read the '?' in this case?
 Convert to string if you can, else don't bother?


regards DaveP

--
DISCLAIMER:

NOTICE: The information contained in this email and any attachments is
confidential and may be privileged.  If you are not the intended
recipient you should not use, disclose, distribute or copy any of the
content of it or of any attachment; you are requested to notify the
sender immediately of your receipt of the email and then to delete it
and any attachments from your system.

RNIB endeavours to ensure that emails and any attachments generated by
its staff are free from viruses or other contaminants.  However, it
cannot accept any responsibility for any  such which are transmitted.
We therefore recommend you scan all attachments.

Please note that the statements and views expressed in this email and
any attachments are those of the author and do not necessarily represent
those of RNIB.

RNIB Registered Charity Number: 226227

Website: http://www.rnib.org.uk

Current Thread