Rob wrote:
Quote:
All I want to do is execute a simple transformation in VB.net.... I know
this has to be simple.
>
I tried the following as suggested by a web page I found....
>
Dim xslt as New XslTransform()
>
xslt.Load("Filename")
xslt.Transform("InFile", "ResultFile")
>
This appears to be very straightforward to me.
>
However, this causes an error saying the code is obsolete... (I thought the
whole Framework version concept meant backwards compatability, but I guess
not.) it further says "You should pass XmlResolver to Transform() method"
>
Can anyone tell me how / where / why to add the XmlResolver ?
The method overload you use (Transform(String, String)) is obsolete in
..NET 1.x. For security reasons you should use the overload
Transform(String, String, XmlResolver)
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlXslXslTransformClassTransformTopic8. asp>
that allows you to pass in a third argument, an XmlResolver, to have the
XSLT document function enabled, or Nothing, to have the XSLT document
function disabled. So the overload with two arguments has been obsoleted
in .NET 1.x to allow for better control by your code whether the XSLT
stylesheet is allowd to use the XSLT document function or not.
So use e.g.
xslt.Transform("InFile", "ResultFile", New XmlUrlResolver())
to allow the stylesheet to use the XSLT document function or use
xslt.Transform("InFile", "ResultFile", Nothing)
to disallow it.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/