|
| Subclassed XPathNodeIterator not accepted by XslTransform? |
|
|
|
|
| Messages |
|
Related Types |
This message was discovered on microsoft.public.dotnet.xml.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
| Gleb Holodov |
| GOOD ANSWER |
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 Click here to reveal e-mail address
|
|
|
| |
|
|
| |
| |
| Dare Obasanjo |
| GOOD ANSWER |
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" <Click here to reveal e-mail address> wrote in message news:O2pVUqUJCHA.3980@tkmsftngp10... [Original message clipped]
|
|
|
| |
|
|
| |
| | |
| |
| Leigh L. Klotz, Jr. |
| GOOD ANSWER |
I have some code for working around this, which I posted to microsoft.public.dotnet.xml on 17 Jun 2002. Briefly, you write an extension object that does the calculation for the XmlNodeList and returns an XPath expression that selects that unique node-set; you then use the existing XPath operations in .NET for creating and returning that object from the extension object.
See http://groups.google.com/groups?selm=c909239.0206171642.4b165c55%40posting.google.com
"Dare Obasanjo" <Click here to reveal e-mail address> wrote in message news:<e3HiFh6JCHA.1596@tkmsftngp13>... [Original message clipped]
|
|
|
| |
|
|
| |
|
|
|
|
|
|
|
|
|
BootFX
Reliable and powerful .NET application framework. |
|
|
|
|
|
|