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

Re: A sequence of more than one item is not allowed as

Subject: Re: A sequence of more than one item is not allowed as the [nth] argument of [function]
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Sun, 6 Mar 2005 06:32:42 -0800 (PST)
xslt concat sequence
Hi Dimitre,
 I am sure Mr. Kay would reply to your question!

But I'll try to explain my feelings with this example
..
If we see the example of Windows.. Suppose my PC is
using dual boot having both Windows 98 and Windows
2000 .. When I start the PC using Windows 98, I cannot
expect Windows 2000 features to work.. But if I start
the PC as Windows 2000 I can use Windows 98 features
in backward compatibility mode.. I feel same logic
should apply to XSLT processor.. It will be simple for
users..

But as presently described in XSLT 2.0 spec , I feel
the things are quite complicated (for users!) , about
backward compatibility..

I have another question -
If I am using a XSLT 2.0 processor (like Saxon 8.1),
which provides backward compatibility.. How can I ask
Saxon 8.1 to work as *XSLT 1.0 only* processor? 

Regards,
Mukul

--- Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:

> This is well explained in Mike's book, page 126 -
> 129.
> 
> Running an XSLT 2.0 processor in
> backwards-compatibility mode is not
> the same as running an XSLT 1.0 processor.
> 
> This is due to the fact that some parts of the
> stylesheet may will
> generally use 2.0 facilities while others will have
> specified
> backwards compatibility (version="1.0").
> 
> This means that the data model to be used cannot be
> the 1.0 data model
> -- therefore the 2.0 data model is used.
> 
> So, running this transformation with Saxon 8.3:
> 
> <xsl:stylesheet version="1.0"
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  >
>   <xsl:output method="text"/>
>   
>  <xsl:template match="/">
>    <xsl:value-of select="1 to 5" version="1.0"/>
>  </xsl:template>
> </xsl:stylesheet>
> 
> produces the result:
>    1
> 
> according to the rules of XPath 1.0 and there's no
> error due to a
> sequence of xs:decimal (an unknown type for XPath
> 1.0) being specified
> in the "select" attribute.
> 
> 
> Running this transformation:
> 
> <xsl:stylesheet version="2.0"
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  >
>   <xsl:output method="text"/>
>   
>  <xsl:template match="/">
>    <xsl:value-of select="1 to 5"/>
>  </xsl:template>
> </xsl:stylesheet>
> 
> produces this result:
>    1 2 3 4 5
> as this is "pure XSLT 2.0"
> 
> However, I cannot understand the result of running
> this transformation
> with Saxon 8.3:
> 
> <xsl:stylesheet version="1.0"
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  >
>   <xsl:output method="text"/>
>  <xsl:template match="/">
>    <xsl:value-of select="1 to 5" version="1.0"
> separator=", "/>
>  </xsl:template>
> </xsl:stylesheet>
> 
> The version specified is "1.0" and one would expect
> the single result "1"
> 
> However, the result is:
>     1, 2, 3, 4, 5
> 
> Probably this is just a bug, or are the rules more
> complex than I thought?
> 
> 
> Cheers,
> Dimitre Novatchev.
> 
> 
> 
> On Sat, 5 Mar 2005 21:16:31 -0800 (PST), Mukul
> Gandhi
> <mukul_gandhi@xxxxxxxxx> wrote:
> > Hello Mr. Kay,
> > 
> > You are saying..
> > "With XSLT 1.0, and with a 2.0 processor in 1.0
> mode,
> > when you pass a sequence to concat() or string()
> it
> > will use the first item in the sequence and ignore
> the
> > rest".
> > 
> > IMHO, in XSLT 1.0 mode using sequence as argument
> to
> > concat() or string() should give an *error*.. As
> > argument of type sequence is not allowed on
> concat()
> > and string() in XPath 1.0 ..
> > 
> > The new string-join() function is great!
> > 
> > Regards,
> > Mukul
> > 
> > --- Michael Kay <mike@xxxxxxxxxxxx> wrote:
> > >
> > > With XSLT 1.0, and with a 2.0 processor in 1.0
> mode,
> > > when you pass a
> > > sequence to concat() or string() it will use the
> > > first item in the sequence
> > > and ignore the rest.
> > >
> > > With XSLT 2.0 "we" decided that was a bad idea,
> so
> > > it's now an error.
> > >
> > > The way to concatenate all the strings in a
> sequence
> > > into a single string is
> > > the new string-join() function.
> > >
> > > Michael Kay
> > > http://www.saxonica.com/



	
		
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

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.