473,385 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

XslTransform - Receiving 'System.Xml.Xsl.XsltException: Missing mandatory attribute 'version'

KJS
Hello,
I'm receiving:
'System.Xml.Xsl.XsltException: Missing mandatory attribute 'version'
After I try and run my transformation. I spent a good few days coming
up with the appropriate (I think) methods, and overrides for this task.
I have verified that the source XML and XSL will transform by means of
using the MSXML command line parsing tool (previous version of MSXML
though).

Here is my code:

public XmlDocument xslTransformer(XPathNavigator xNav, XsltArgumentList
xArgs)
{
//get xsl source
XslTransform xslObj = new XslTransform();

//default permission set
Evidence ev = XmlSecureResolver.CreateEvidenceForUrl
(classXSLObjectSource);
PermissionSet ps = SecurityManager.ResolvePolicy(ev);

//modify access for specific domain
// WebPermission myWebPermission = new
WebPermission(NetworkAccess.Connect,
// "http://www.example.com");
// myPermissions.SetPermission(myWebPermission);

//wrap with xmlsecureresolver
XmlUrlResolver urlR = new XmlUrlResolver();
XmlSecureResolver xmlSR = new XmlSecureResolver(urlR,ps);
xslObj.Load(xNav,xmlSR,ev);

StringWriter sWrit = new StringWriter();

//transform the xml
xslObj.Transform(xNav,xArgs,sWrit,xmlSR);
XmlDocument xmlREturn = new XmlDocument();
xmlREturn.Load(sWrit.ToString());

return(xmlREturn);
}

Any ideas?
Thanks,
Karl..
Nov 13 '05 #1
2 3694
KJS wrote:
public XmlDocument xslTransformer(XPathNavigator xNav, XsltArgumentList
xArgs)
{
//get xsl source
XslTransform xslObj = new XslTransform();

xslObj.Load(xNav,xmlSR,ev);

//transform the xml
xslObj.Transform(xNav,xArgs,sWrit,xmlSR);


This is weird. You are loading XSLT stylesheet from xNav and then
transform the same XSLT stylesheet? You seems to be havily MSXML minded,
in .NET many things are simpler. Just show me what do you need to
perform and I'll provide .NET solution.

--
Oleg Tkachenko [XML MVP, MCAD]
http://www.XmlLab.Net | http://www.XLinq.Net | http://blog.tkachenko.com
Nov 13 '05 #2
KJS
In article <e6**************@TK2MSFTNGP10.phx.gbl>, so**@body.com
says...
KJS wrote:
public XmlDocument xslTransformer(XPathNavigator xNav, XsltArgumentList
xArgs)
{
//get xsl source
XslTransform xslObj = new XslTransform();

xslObj.Load(xNav,xmlSR,ev);

//transform the xml
xslObj.Transform(xNav,xArgs,sWrit,xmlSR);


This is weird. You are loading XSLT stylesheet from xNav and then
transform the same XSLT stylesheet? You seems to be havily MSXML minded,
in .NET many things are simpler. Just show me what do you need to
perform and I'll provide .NET solution.


I am (was) heavily MSXML minded : )
I was looking for the *simplest* method for transforming XML in .NET (I
understand how to do this very well in the previous versions of MSXML
with classic ASP, VB, etc..)

In .NET I started with the objects: XslTransform, XmlDocument, and
XsltArgumentList.

My XML is supplied from a dataset after querying the database (MySql -
which has some interesting problems by the way, especially dates, but
another topic of course). So, I am providing the XML source from a
dataset (not from file I/O) The XSLT is located local to my application
and is read in accordingly.

I was sure I had everything lined up correctly for this *simple*
transformation, but found that my method calls were "obsolete" and I
should use the "resolver" (XmlUrlResolver) in the load of the stylesheet
and that I should pass "evidence" and WOW! This turned out to be a
nightmare, but I figured it out!!! (so I thought) Now I'm stuck with
this error:

'System.Xml.Xsl.XsltException: Missing mandatory attribute 'version'

Let me summarize the desired operation:
1. Query Database to XML (I use to Save right from recordset in classic
- which I like better, I like the XML better)
2. Transform XML to HTML or to XML
3. I will either stream the result to the Response object (for web) or I
might transform the XML and return XML for something later. For the
most part, will be streaming the result to the browser.

Thanks for the help!
Karl..
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Hyunchan Kim | last post by:
To indent xml file, I made an instance of Transformer from Templates using following. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"...
1
by: Paul | last post by:
Hi trying to deploy to a web server and got the system.data missing. I found the dll on the local machine and copied it over to the bin directory on the server. It found it but then got the...
1
by: Mike | last post by:
I have 2 System.Web.dll taken from 2 different machines, one of the System.Web.Dll contains a enum System.Web.UI.WebControls.TableCaptionAlign and the other did not. I have development a...
2
by: Alan Silver | last post by:
Hello, I'm getting an odd validation error from VWD. As I understand it, an opening ASP.NET for tag is supposed to look like... <form runat="server"> with an optional ID attribute. VWD...
1
by: Sky | last post by:
Yesterday I was told that GetType(string) should not just be with a Type, but be Type, AssemblyName. Fair enough, get the reason. (Finally!). As long as it doesn't cause tech support problems...
5
by: Bosconian | last post by:
I'm attempting to submit a form via a function which dynamically creates a hidden input: function submitLocation(theForm) { var e = document.createElement('input'); e.setAttribute('type',...
8
by: Gamma | last post by:
I'm trying to inherit subclass from System.Diagnostics.Process, but whenever I cast a "Process" object to it's subclass, I encounter an exception "System.InvalidCastException" ("Specified cast is...
2
by: wellerc1 | last post by:
Looking for help to resolve error I am getting when I run vbs scripts. Scripts execute DLL components which use DB2 Connect to pull data. scripts does a name search creating an ADODB.Recordset...
3
by: Mike | last post by:
Hi I have problem as folow: Caught Exception: System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Request for the permission of type...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.