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

Subject: Re: [xsl] Type error? Too many items?
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Fri, 26 Jan 2007 14:31:40 -0000
Owen

Not sure but none of Microsoft's products support XSLT 2.0 so I'm surprised you got as far as that with Visual Studio.

Joe
----- Original Message ----- From: "Owen Blacker" <owen@xxxxxxxxxxxxx>
To: "XSL list" <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, January 26, 2007 1:56 PM
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