Topaz Filer: if you use e-mail for business, we can save you money and decrease your risk.
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
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

Reply to this message...
Vote that this is a GOOD answer...
 
Auto-following on Twitter
Ubuntu and XP on one “desktop”
 
    
Dare Obasanjo
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]

Reply to this message...
Vote that this is a GOOD answer...
 
Outlook interop - stopping user properties appearing on Outlook message print
Seriously, why is “cut and paste” majorly newsworthy???
 
    
Tomas Restrepo (VIP)
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
Click here to reveal e-mail address

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Leigh L. Klotz, Jr.
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]

Reply to this message...
Vote that this is a GOOD answer...
 
Email Archiving and Email Filing - what’s the difference?
Web-based task/todo list management
 
 
System.NotSupportedException
System.Xml.XmlNodeList
System.Xml.XPath.XPathNavigator
System.Xml.XPath.XPathNodeIterator
System.Xml.Xsl.XsltArgumentList




Ad
BootFX
Reliable and powerful .NET application framework.
Recession Busting Bespoke Software
Get through the recession by investing in bespoke software to decrease costs and create commercial opportunities.
Other DN247 Network Sites
.NET 247
SQL Server Wins
Old Skool Developer
 
Copyright © AMX Software Ltd 2008-2009. Portions copyright © Matthew Baxter-Reynolds 2001-2009. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - .NET 247 is a member of the DN247 Network - 4.0.30129.1734