Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / February 2008

Tip: Looking for answers? Try searching our database.

DOMDocument to XslCompiledTransform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tom Bean - 07 Feb 2008 17:29 GMT
I am trying to convert C# project from .NET 1.1 to .NET 2.0.  I am using the
XML Document Object Model to display an XML string in a webbrowser control
and would like to covert to XslCompiledTransform.  I am having problems
finding a stylesheet to use with XslCompiledTransform.

In the old code, I instantiate a MSXML2.DOMDocument30 object and call
load("res://msxml2.dll/DEFAULTSS.xsl").

In the new code, I instantiate a XslCompiledTransform object and call
Load("res://msxml2.dll/DEFAULTSS.xsl").  This gives me the error "the URI
prefix is not recognized".

What stylesheet URI can I pass to the XslCompiledTransform Load() method to
get the default stylesheet used by Internet Explorer?

Thank,
Tom
Martin Honnen - 07 Feb 2008 17:44 GMT
> I am trying to convert C# project from .NET 1.1 to .NET 2.0.  I am using the
> XML Document Object Model to display an XML string in a webbrowser control
[quoted text clipped - 10 lines]
> What stylesheet URI can I pass to the XslCompiledTransform Load() method to
> get the default stylesheet used by Internet Explorer?

As far as I know the default stylesheet that Internet Explorer uses is
not an XSLT 1.0 stylesheet but rather one written in a working draft
version, a predecessor of the XSLT 1.0 language. Only MSXML 3 and older
support that language, XslCompiledTransform definitely does not support
it. Therefore even if you extract that IE default stylesheet, it does
not work with XslCompiledTransform.

I think Oleg Tkachenko in his eXml control
<URL:http://www.xmllab.net/Products/eXml/tabid/174/Default.aspx> has an
XSLT 1.0 stylesheet that you can run with XslCompiledTransform. Or
simply use the eXml control in your ASP.NET web pages, it has a property
ShowFriendlyXml to pretty-print XML.

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

Tom Bean - 07 Feb 2008 20:41 GMT
Martin,

Do you mean there is no version of DEFAULTSS.xsl that has been converted to
be compatible with XSLT 1.0 so it can be used with XslCompiledTransform?

Why would Microsoft depricate XmlTransform with nothing to allow
XslCompiledTransform to display XML in a web browser control?

Thanks,
Tom

>> I am trying to convert C# project from .NET 1.1 to .NET 2.0.  I am using
>> the XML Document Object Model to display an XML string in a webbrowser
[quoted text clipped - 23 lines]
> use the eXml control in your ASP.NET web pages, it has a property
> ShowFriendlyXml to pretty-print XML.
Oleg Tkachenko - 07 Feb 2008 22:26 GMT
Microsoft never converted defaultss.xsl to XSLT.
This isn't possible, because WD-XSL had different data model, e.g.
defaultss.xsl supports xml declaration and CDATA sections, which is
impossible in XSLT.
You can get XSLT version (a bit limited WRT above) at
http://www.dpawson.co.uk/xsl/sect2/microsoft.html#d7451e227
Signature

Oleg

> Martin,
>
[quoted text clipped - 33 lines]
>> use the eXml control in your ASP.NET web pages, it has a property
>> ShowFriendlyXml to pretty-print XML.
Martin Honnen - 08 Feb 2008 12:54 GMT
> Do you mean there is no version of DEFAULTSS.xsl that has been converted to
> be compatible with XSLT 1.0 so it can be used with XslCompiledTransform?

There are various attempts to convert that default.xsl to XSLT 1.0, I
pointed you to eXml which contains one I think. You can also search the
web, I think Dimitre Novatchev's XPath visualizer has one too.

> Why would Microsoft depricate XmlTransform with nothing to allow
> XslCompiledTransform to display XML in a web browser control?

I don't understand that question. What is "XmlTransform" exactly? The
.NET framework has two XSLT 1.0 processors, one is
System.Xml.Xsl.XslTransform to be used in .NET 1.x, the second is
XslCompiledTransform in the same namespace, to be used in .NET 2.0 and
later. Both do support XSLT 1.0 only, not the working draft version that
MSXML 3 and older support. And MSXML is completely independent of the
.NET framework.
As for the web browser control, that is a WinForms control
<URL:http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx>
in .NET 2.0 and later. As far as I understand, it is a managed wrapper
around the native web browser control so it uses MSXML 3 anyway to parse
and display XML.

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

WenYuan Wang [MSFT] - 12 Feb 2008 09:51 GMT
Thanks for Martin's prompt reply.

Hello Tom,

It seems XslCompiledTransform.load() method doesn't support res protocol.
This results the "URI prefix is not recognized" error.

I'd like to suggest you copy the content of defaults.xsl to new xsl file,
and save it under your project folder. Then, you can pass the new xsl file
into XslCompiledTransform.load() directly. Doesn't this method work?

Hope this helps. Let me know if this is what you need. We are glad to
assist you.
Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Oleg Tkachenko - 12 Feb 2008 14:33 GMT
That won't help anyway, because res://msxml2.dll/DEFAULTSS.xsl is not
XSLT stylesheet. Only MSXML3 still supports old dialect it was written in.

Signature

Oleg

> Thanks for Martin's prompt reply.
>
[quoted text clipped - 16 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
WenYuan Wang [MSFT] - 13 Feb 2008 06:45 GMT
Oleg is right.
I looked into defaultss.xsl file. Just as Martin mentioned, it's not an
XSLT 1.0 stylesheet.

Hello Tom,
If you need an XSLT 1.0 compliant version of that, please check the file
which Oleg suggested.
http://www.dpawson.co.uk/xsl/sect2/microsoft.html#d7451e227
[msxml default stylesheet - now in XSLT]
or
http://www.peterprovost.org/archive/2004/01/30/1049.aspx
[Trouble Finding Defaultss.xsl]

Do you face any further issue so far? If true, please feel free to update
here again. We are glad to assist you.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
======================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Tom Bean - 27 Feb 2008 19:52 GMT
Wen Yuan,

Thanks for your follow up.  I got around the warnings by using msxml.dll and
using a DOMDocument instead of a DOMDocument30.  Once I made the change, I
was able to use the DefaultSS.xsl with out getting the 60+ warnings which
were output with DOMDocument30.

Thanks,
Tom

> Oleg is right.
> I looked into defaultss.xsl file. Just as Martin mentioned, it's not an
[quoted text clipped - 20 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Wen Yuan Wang [MSFT] - 28 Feb 2008 08:33 GMT
You are welcome, Tom.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
======================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.