What's wrong with XslTransform's API?

| 4 Comments | No TrackBacks

I wonder if is there is something inherently wrong with XslTransform's class API? I was stunned again today reading this post in microsoft.public.dotnet.xml newsgroup:

I still don't see any way to create a XslTransform from a XmlDocument?
That's not the first time I see it actually. The answer of course is - XmlDocument implements IXPathNavigable, so just pass it to Load() method as is. Many developers don't see it, I wonder why?

I'd like to ask - do YOU think XslTransform class provide intuitive enough API (I mean these 5 overloads of Load() and 9 Transform() methods, not including obsolete ones)?

Related Blog Posts

No TrackBacks

TrackBack URL: http://www.tkachenko.com/cgi-bin/mt-tb.cgi/372


Well, you are right about complexity and wrong about XmlDocument.
In fact XmlDocument class extends XmlNode, which implements IXPathNavigable, so it's safe to say XmkDocument implements IXPathNavigable.

That's really another layer of confusion.

Still I wonder what's wrong with this. The design seems to be okay and documentation too - there is even a dedicated page at MSDN called "XmlDocument Input to XslTransform" at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconXmlDocumentInputToXslTransform.asp which explains the stuff very well, still users have troubles.

XmlDocument doesn't implement IXPathNavigable (XPathDocument does though). If a person is just learning XSLT, learning the MS Xml classes add another layer. That may add to the confusion.

Yeah, that's definitely the key trouble - the lack of association between XmlDocument and IXPathNavigable. Some people know they can get XPathNavigator from XmlDocument - so they use
xslt.Transform(doc.CreateNavigator(), ...


As I see here people who worked long time wiht MSXML 4 API and who did not read anything about reader, writers and navigators usually cannot understand how to use XslTransform. Not too much people used input/output proerties before etc. For those people there is no any association between XmlDocument and IXPathNavigable. However, it is great push to find out which classes implemnt it.

Leave a comment