Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Subclassed XPathNodeIterator not accepted by XslTransform?

7 views
Skip to first unread message

Gleb Holodov

unread,
Jul 6, 2002, 8:15:10 PM7/6/02
to
Hi!

I'm making a custom XSLT extension object (to be used via XsltArgumentList.
AddExtensionObject) and one of its functions accessible from XSLT returns a
node iterator:

-----v
public XPathNodeIterator UniqueNodes( XPathNodeIterator nodes, string
keyXPath )
-----^

So far so good. Returning XPathNodeIterator acquired from the calls to
standard .NET XPath classes works OK, but trying to return my own custom
node iterator derived from XPathNodeIterator raises the next error:

-----v
System.NotSupportedException: XPathNodeIteratorOnCollection is an
unsupported type.
at System.Xml.XPath.XsltFunction.InvokeFunction(XPathNavigator qy)
-----^


My node iterator is defined as
-----v
public class XPathNodeIteratorOnCollection : XPathNodeIterator
-----^
and it implements all the methods described in the SDK. After playing with
ILDASM for awhile, I've figured out that an exception above is thrown after
unsuccessful attempt to cast my iterator to
System.Xml.XPath.ResetableIterator, which is marked as private and therefore
could not be inherited in user apps. So, it appears that all those
magnificent words in XPathNodeIterator docs like "When overridden in a
derived class, ..." are for MS-eyes only [sigh]... Obviously, currently it's
by-design. Will the situation change in the next release?

So, what I need is to make a C# XSLT function, which will return a node
set, for which members I can't generate an XPath query and then take a
standard iterator via XPathNavigator.Select.

Can anyone suggest any acceptable workaround? Any help would be greatly
appreciated!


--
Warmest regards, Gleb Holodov

Software Developer
ThinkWave Inc.
www.thinkwave.com
gl...@NO-SPAM.thinkwave.com

Dare Obasanjo

unread,
Jul 9, 2002, 8:26:02 PM7/9/02
to
Thanks for the pointer, a bug for this has been filed which should be fixed
in a future release.

--
This posting is provided "AS IS" with no warranties, and confers no rights.


"Gleb Holodov" <g...@mail.ru> wrote in message
news:O2pVUqUJCHA.3980@tkmsftngp10...

Tomas Restrepo

unread,
Jul 9, 2002, 11:32:05 PM7/9/02
to
Hi Dare,

> Thanks for the pointer, a bug for this has been filed which should be
fixed
> in a future release.

Hope so! I got bitten by that problem a few weeks ago (see [1] and [2] for
the gory details), so I'd really like to see it fixed ;)


[1] http://www.winterdom.com/weblog/archives/000087.html
[2] http://www.winterdom.com/weblog/archives/000091.html

--
Tomas Restrepo
tom...@mvps.org


0 new messages