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

RE: Type error? Too many items?

Subject: RE: Type error? Too many items?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 26 Jan 2007 14:53:50 -0000
RE:  Type error? Too many items?
My guess would be that

following-sibling::h3

is selecting more than one h3, and that you should have written

following-sibling::h3[1]

If that's the case it's a good example of type-checking catching your errors
- and it also illustrates that there's not much point catching the errors if
the resulting diagnostics don't pinpoint the problem.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: owen@xxxxxxxxxxx [mailto:owen@xxxxxxxxxxx] On Behalf Of 
> Owen Blacker
> Sent: 26 January 2007 13:56
> To: XSL list
> Subject:  Type error? Too many items?
> 
> I'm developing using Altova XMLSpy 2006 Visual Studio .NET 
> Edition (rel
> 3 SP1) and my XSLT is complaining about "Type error, value 
> does not match a required type as specified by the matching 
> rules in 2.5.4 SequenceType Matching. - 'node()'", yet if I 
> put a watch on the XPaths "." and "../*", they are exactly 
> the types I'd expect (a node() and a node()* of length ~20), 
> if I set a breakpoint at the xsl:call-template statement.
> 
> Then, if I remove the as attributes on the xsl:with-param 
> elements, it tells me "Too many items" on the xsl:if.  I 
> really can't see what's going on here.
> 
> Any suggestions greatfully received!
> 
> 
> Owen
> 
> XSLT excerpts:
> 
> <xsl:call-template name="module-bodies">
>     <xsl:with-param name="current-position"
>        select="foo:index-of-node(., ../*)"/>
>     <xsl:with-param name="future-position"
>        select="foo:index-of-node(following-sibling::h3, 
> ../*)"/> </xsl:call-template>
> 
> ...
> 
> <xsl:function name="foo:index-of-node" as="xs:integer*">
>     <xsl:param name="srch" as="node()"/>
>     <xsl:param name="sequence" as="node()*"/>
> 
>     <xsl:for-each select="$sequence">
>        <xsl:if test=". is $srch">
>           <xsl:sequence select="position()"/>
>        </xsl:if>
>     </xsl:for-each>
> </xsl:function>
> 
> XML:
> 
> <div>
>     <h3> ... </h3>
>     <p> ... </p>
>     <p> ... </p>
> 
>     <h3> ... </h3>
>     <p> ... </p>
>     <p> ... </p>
> 
>     <!-- etc --->
> </div>
> 
> --
> Owen Blacker, London GB
> Say no to ID cards: www.no2id.net
> Get your mitts off my bits: www.openrightsgroup.org
> --
> Those who would give up essential liberty to purchase a 
> little temporary
>   safety, deserve neither liberty nor safety  -- Benjamin 
> Franklin, 1759

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.