Bug 6988 - XsltCompileException while loading XSL with embedded msxsl script
Summary: XsltCompileException while loading XSL with embedded msxsl script
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-09-07 09:55 UTC by siraleigh2012
Modified: 2012-09-11 06:27 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
xsl stylesheet (1.93 KB, text/xml)
2012-09-07 09:55 UTC, siraleigh2012
Details
associated XML data file (237 bytes, text/xml)
2012-09-07 09:56 UTC, siraleigh2012
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_ON_ROADMAP

Description siraleigh2012 2012-09-07 09:55:25 UTC
Created attachment 2474 [details]
xsl stylesheet

Trying to load an XSL stylesheet that contains an embedded custom C# function. System throws an exception on the line referencing the msxsl namespace in the XSL file. Here's sample C# code to load and transform the XSL. This code and stylesheet works fine in VS2010.

        public System.Xml.XmlDocument SerializeToXml()
        {
            System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
            xmlDoc.Load("perstat.xml");
            return xmlDoc;
        }

        private String CreateHtml(String printTemplate)
        {
            try
            {
                MemoryStream memXmlStream = new MemoryStream();
                
                System.Xml.Xsl.XslTransform myXslTransform;
                myXslTransform = new System.Xml.Xsl.XslTransform();
                myXslTransform.Load(printTemplate);

                myXslTransform.Transform(SerializeToXml(), null, memXmlStream);
                memXmlStream.Seek(0, System.IO.SeekOrigin.Begin);

                System.IO.StreamReader reader = new System.IO.StreamReader(memXmlStream);
                //Console.Write(reader.ReadToEnd());
                return reader.ReadToEnd();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                MessageBox.Show("An error occurred while trying to print");
                return null;
            }

        }


{System.Xml.Xsl.XsltCompileException: XSLT compile error. The requested feature is not implemented. at file:///Users/mahmood1/Library/Application Support/iPhone Simulator/5.0/Applications/CE288E68-580B-43F9-A026-C35A8ECCFB02/DigitalLeadersBookArmy.app/Xsl/Perstat.xsl(6,4). ---> System.NotImplementedException: The requested feature is not implemented.   at Mono.Xml.Xsl.MSXslScriptManager+MSXslScript.Compile (System.Xml.XPath.XPathNavigator node) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/Mono.Xml.Xsl/MSXslScriptManager.cs:133    at Mono.Xml.Xsl.MSXslScriptManager.AddScript (Mono.Xml.Xsl.Compiler c) [0x00047] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/Mono.Xml.Xsl/MSXslScriptManager.cs:60    at Mono.Xml.Xsl.XslStylesheet.HandleTopLevelElement (Mono.Xml.Xsl.Compiler c) [0x002fb] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs:474    at Mono.Xml.Xsl.XslStylesheet.ProcessTopLevelElements (Mono.Xml.Xsl.Compiler c) [0x000f1] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs:542    at Mono.Xml.Xsl.XslStylesheet.Compile (Mono.Xml.Xsl.Compiler c) [0x001f8] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs:160    at Mono.Xml.Xsl.Compiler.Compile (System.Xml.XPath.XPathNavigator nav, System.Xml.XmlResolver res, System.Security.Policy.Evidence evidence) [0x0010f] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs:187    --- End of inner exception stack trace ---   at Mono.Xml.Xsl.Compiler.Compile (System.Xml.XPath.XPathNavigator nav, System.Xml.XmlResolver res, System.Security.Policy.Evidence evidence) [0x00124] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs:191    at System.Xml.Xsl.XslTransform.Load (System.Xml.XPath.XPathNavigator stylesheet, System.Xml.XmlResolver resolver, System.Security.Policy.Evidence evidence) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs:391    at System.Xml.Xsl.XslTransform.Load (System.String url, System.Xml.XmlResolver resolver) [0x0005b] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs:317    at System.Xml.Xsl.XslTransform.Load (System.String url) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs:302    at DigitalLeadersBookArmy.PrintUtil.CreateHtml (System.Object objectToPrint, System.String printTemplate) [0x0000c] in /Users/mahmood1/Documents/masterdetail/masterdetail/Utility/PrintUtil.cs:100 }
Comment 1 siraleigh2012 2012-09-07 09:56:47 UTC
Created attachment 2475 [details]
associated XML data file
Comment 2 Rolf Bjarne Kvinge [MSFT] 2012-09-11 06:27:54 UTC
You're running into this: https://github.com/mono/mono/blob/master/mcs/class/System.XML/Mono.Xml.Xsl/MSXslScriptManager.cs#L132

The problem for MonoTouch is that it is not possible to execute code dynamically like this, it has to be compiled (to native code) into the app before installing the app on a device (this is an iOS restriction), so this will unfortunately not be fixed.