//
// (C)2003 Atsushi Enomoto
//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
using System;
using System.Diagnostics;
using System.Collections;
namespace Mono.Xml.Xsl {
- [MonoTODO ("Correct evedence handling; test other than simple string case")]
- public class MSXslScriptManager {
+ // FIXME: Correct evidence handling; test other than simple string case
+ internal class MSXslScriptManager {
Hashtable scripts = new Hashtable ();
- Evidence evidence;
public MSXslScriptManager () {}
public void AddScript (Compiler c)
{
- MSXslScript s = new MSXslScript (c.Input, c.Evidence, scripts.Count);
- this.evidence = c.Evidence;
- scripts.Add (c.Input.GetNamespace (s.ImplementsPrefix), s.Compile ());
+ MSXslScript s = new MSXslScript (c.Input, c.Evidence);
+ string ns = c.Input.GetNamespace (s.ImplementsPrefix);
+ if (ns == null)
+ throw new XsltCompileException ("Specified prefix for msxsl:script was not found: " + s.ImplementsPrefix, null, c.Input);
+ scripts.Add (ns, s.Compile (c.Input));
}
enum ScriptingLanguage {
ScriptingLanguage language = ScriptingLanguage.JScript; // default = JScript.
string implementsPrefix = null;
string code = null;
- string suffix;
- XPathNavigator node;
Evidence evidence;
- public MSXslScript (XPathNavigator nav, Evidence evidence, int suffix)
+ public MSXslScript (XPathNavigator nav, Evidence evidence)
{
- node = nav.Clone ();
this.evidence = evidence;
- this.suffix = suffix.ToString ();
code = nav.Value;
if (nav.MoveToFirstAttribute ()) {
do {
get { return code; }
}
- public object Compile ()
+ public object Compile (XPathNavigator node)
{
- string suffix = Guid.NewGuid ().ToString ().Replace ("-", String.Empty);
+#if TARGET_JVM
+ throw new NotImplementedException ();
+#else
+ string suffix = Guid.NewGuid ().ToString ("N");
switch (this.language) {
case ScriptingLanguage.CSharp:
return new CSharpCompilerInfo ().GetScriptClass (Code, suffix, node, evidence);
default:
return null;
}
+#endif
}
}
}