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

RE: Type error with variable as=xs:string using xsl:

Subject: RE: Type error with variable as=xs:string using xsl:choose
From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
Date: Thu, 7 Sep 2006 22:08:15 +1200
typeerror error 2007
Ah, I get it now. Thanks!

Cheers
Trevor
 
-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx] 
Sent: Thursday, 7 September 2006 9:41 p.m.
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Type error with variable as=xs:string using xsl:choose


  <xsl:text>images/</xsl:text>
  <xsl:value-of select="substring-after($xsrc,'/images/images/')" />

makes a sequence of length 2, a text node and a string, as you have the
as= attribute these are not merged into an implict document node (at
which point they would be merged into a single text node)
so you get a type error from xsl:string which requires a single item.

Easiest is to use
<xsl:variable name="normsrc" as="xs:string">
<xsl:value-of>
<xsl:choose>
...
</xsl:choose>
</xsl:value-of>
</xsl:variable>

value-of scoops up anything in the content and makes a single text node
which then gets coerced to a string because of thee as= attribute.



David

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.