Subject: RE: [xsl] Type error? Too many items? From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Fri, 26 Jan 2007 14:53:50 -0000 |
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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Type error? Too many item, Joe Fawcett | Thread | [xsl] XQuery list, Joe Fawcett |
Re: [xsl] XQuery list, George Cristian Bina | Date | Re: [xsl] XQuery list, Joe Fawcett |
Month |