Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] A sequence of more than one item is not allowed as the value of item

From: David Carlisle <davidc@--------->
To:
Date: 6/1/2005 11:27:00 AM
The goal of specifying as="xs:string" is to prevent the unnecessary
  contruction of a document node.

Yes, I know but I think you hit the rough edges where the strict typing
aspects of 2.0 hit the reality of compatibility with XSLT 1's more easy
going style.

xsl:variable already had this switch of behaviour between using a select
attribute and using content, and that fits rather uneasily with the new
2.0 features. If using select attribute, then adding an as attribute
works fairly naturally (although it doesn't do a lot that couldn't be
done by adding an explict cast in the XPath expression in the select
attribute).  But in an xsl:variable with content adding an as attribute
has this dual role of stopping the implicit document node and forcing
the type checking. This is a bit ugly but given the general premise that
they were trying to graft the typing on to the existing syntax it works
well enough. If you just want to stop the implicit document node and not
force any type checking then you can use the most general type item()* so
you can do

<xsl:template match="/">
 <xsl:variable name="foo" as="item()*">
   <xsl:text/>abc<xsl:sequence select="'def'"/>
 </xsl:variable>
 
By default spaces will be inserted when you value-of this but you can do


 <xsl:value-of select="$foo" separator=""/>	

to get abcdef

if you want.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent