xsl-list
[Top] [All Lists]

RE: [xsl] Type error? Too many items?

2007-01-26 07:54:11
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(_at_)flirble(_dot_)org [mailto:owen(_at_)flirble(_dot_)org] 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>