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

Re: [XSLT 3.0]

Subject: Re: [XSLT 3.0]
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Thu, 01 Nov 2012 08:17:39 +0000
Re:  [XSLT 3.0]
Option A is fine. (This is nothing really to do with function items, the answer would be the same if you were talking about a sequence containing elements and text nodes...)

"treat as" is never needed in systems that do dynamic type checking. It makes an assertion about the dynamic type which basically tells a static type system to defer type checking till run-time. But as far as I know all XSLT 2.0 processors do this anyway without being asked. There are a few XQuery processors that don't (e.g. the one from Microsoft), but they aren't widely used.

Michael Kay
Saxonica

On 01/11/2012 01:32, sean@xxxxxxxxxxxxxxxxx wrote:
Suppose that $state is a sequence which contains, among other things, at least one function item with signature...

function(element(square)*) as element(square)*

Which is the correct and safe way to store a reference to this function in a variable?

Is it OPTION A?

    <xsl:variable name="compute-possible-moves"
         select="$state[. instance of function(*)][1]"
         as="function(element(square)*) as element(square)*">

... OR OPTION B?

<xsl:variable name="compute-possible-moves"
select="$state[. instance of function(*)][1]
treat as function(element(square)*) as element(square)*"">


... OR OPTION C?

    <xsl:variable name="compute-possible-moves"
         select="$state[. instance of function(*)][1]
                 treat as function(element(square)*) as element(square)*"
         as="function(element(square)*) as element(square)*">

My best estimate at the moment, would be option A, but I am not really sure about it.


Faithfully, Sean B. Durkin

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.