Author: atsushi
Date: 2005-03-04 10:29:21 -0500 (Fri, 04 Mar 2005)
New Revision: 41444
Added:
trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNotSupportedOperation.cs
Modified:
trunk/mcs/class/System.XML/ChangeLog
trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog
trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCompiledElement.cs
trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslTemplateContent.cs
trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
trunk/mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs
trunk/mcs/class/System.XML/System.Xml.dll.sources
Log:
2005-03-04 Atsushi Enomoto <[EMAIL PROTECTED]>
* XslNotSupportedOperation.cs : added not-supported template content
type. Such elements should be rejected only run-time (since there
could be future-version-only template content).
* XslCompiledElement.cs : added XslCompiledElementBase type, for
not invoking Compile() in base .ctor() (in some types this design
forces us to add extraneous protected fields to the base type).
* XslTemplateContent.cs : added "sort" element check (except for
xsl:for-each, it should be skipped).
* Compiler.cs : added another CompileTemplateContent() which is
requred in xsl:for-each. Commented out unused method.
* System.Xml.dll.sources : Added XslNotSupportedOperation.cs.
Modified: trunk/mcs/class/System.XML/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/ChangeLog 2005-03-04 15:08:09 UTC (rev
41443)
+++ trunk/mcs/class/System.XML/ChangeLog 2005-03-04 15:29:21 UTC (rev
41444)
@@ -1,3 +1,7 @@
+2004-03-04 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * System.Xml.dll.sources : Added XslNotSupportedOperation.cs.
+
2004-01-21 Atsushi Enomoto <[EMAIL PROTECTED]>
* Makefile : /nowarn:0162 is back.
Modified: trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog 2005-03-04 15:08:09 UTC
(rev 41443)
+++ trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog 2005-03-04 15:29:21 UTC
(rev 41444)
@@ -1,3 +1,8 @@
+2005-03-04 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * Compiler.cs : added another CompileTemplateContent() which is
+ requred in xsl:for-each. Commented out unused method.
+
2005-03-03 Atsushi Enomoto <[EMAIL PROTECTED]>
* XslStylesheet.cs, XslTransformProcessor.cs : exclude-element-prefix
Modified: trunk/mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs 2005-03-04 15:08:09 UTC
(rev 41443)
+++ trunk/mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs 2005-03-04 15:29:21 UTC
(rev 41444)
@@ -373,13 +373,18 @@
public XslOperation CompileTemplateContent ()
{
- return CompileTemplateContent (XPathNodeType.All);
+ return CompileTemplateContent (XPathNodeType.All,
false);
}
public XslOperation CompileTemplateContent (XPathNodeType
parentType)
{
- return new XslTemplateContent (this, parentType);
+ return CompileTemplateContent (parentType, false);
}
+
+ public XslOperation CompileTemplateContent (XPathNodeType
parentType, bool xslForEach)
+ {
+ return new XslTemplateContent (this, parentType,
xslForEach);
+ }
#endregion
#region Variables
public void AddGlobalVariable (XslGlobalVariable var)
@@ -563,11 +568,12 @@
{
return XslNameUtil.FromString (s, Input);
}
-
+ /*
XmlNamespaceManager IStaticXsltContext.GetNsm ()
{
return currentNsm;
}
+ */
public XmlNamespaceManager GetNsm ()
{
Modified: trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog
2005-03-04 15:08:09 UTC (rev 41443)
+++ trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog
2005-03-04 15:29:21 UTC (rev 41444)
@@ -1,3 +1,14 @@
+2005-03-04 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XslNotSupportedOperation.cs : added not-supported template content
+ type. Such elements should be rejected only run-time (since there
+ could be future-version-only template content).
+ * XslCompiledElement.cs : added XslCompiledElementBase type, for
+ not invoking Compile() in base .ctor() (in some types this design
+ forces us to add extraneous protected fields to the base type).
+ * XslTemplateContent.cs : added "sort" element check (except for
+ xsl:for-each, it should be skipped).
+
2005-03-03 Atsushi Enomoto <[EMAIL PROTECTED]>
* XslElement.cs : reject incorrectly qualified name attribute.
Modified:
trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCompiledElement.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCompiledElement.cs
2005-03-04 15:08:09 UTC (rev 41443)
+++ trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCompiledElement.cs
2005-03-04 15:29:21 UTC (rev 41444)
@@ -38,29 +38,22 @@
using QName = System.Xml.XmlQualifiedName;
-namespace Mono.Xml.Xsl.Operations {
-
- internal abstract class XslCompiledElement : XslOperation {
+namespace Mono.Xml.Xsl.Operations
+{
+ internal abstract class XslCompiledElementBase : XslOperation
+ {
int lineNumber;
int linePosition;
- XPathNodeType parentType;
-
- public XslCompiledElement (Compiler c) : this (c,
XPathNodeType.Root)
- {
- }
- public XslCompiledElement (Compiler c, XPathNodeType parentType)
+ // It does not automatically invoke Compile() in .ctor()
+ public XslCompiledElementBase (Compiler c)
{
- this.parentType = parentType;
IXmlLineInfo li = c.Input as IXmlLineInfo;
if (li != null) {
lineNumber = li.LineNumber;
linePosition = li.LinePosition;
}
- this.Compile (c);
}
-
- protected abstract void Compile (Compiler c);
public int LineNumber {
get { return lineNumber; }
@@ -70,8 +63,15 @@
get { return linePosition; }
}
- public XPathNodeType ParentType {
- get { return parentType; }
+ protected abstract void Compile (Compiler c);
+ }
+
+ internal abstract class XslCompiledElement : XslCompiledElementBase
+ {
+ public XslCompiledElement (Compiler c)
+ : base (c)
+ {
+ this.Compile (c);
}
}
}
Added:
trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNotSupportedOperation.cs
===================================================================
---
trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNotSupportedOperation.cs
2005-03-04 15:08:09 UTC (rev 41443)
+++
trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNotSupportedOperation.cs
2005-03-04 15:29:21 UTC (rev 41444)
@@ -0,0 +1,61 @@
+//
+// XslNotSupportedOperation.cs
+//
+// Authors:
+// Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+// (C)2005 Novell Inc,
+//
+
+//
+// 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.Collections;
+using System.IO;
+using System.Xml;
+using System.Xml.XPath;
+using System.Xml.Xsl;
+
+using QName = System.Xml.XmlQualifiedName;
+
+namespace Mono.Xml.Xsl.Operations
+{
+ internal class XslNotSupportedOperation : XslCompiledElement
+ {
+ string name;
+
+ public XslNotSupportedOperation (Compiler c)
+ : base (c)
+ {
+ }
+
+ protected override void Compile (Compiler c)
+ {
+ name = c.Input.LocalName;
+ }
+
+ public override void Evaluate (XslTransformProcessor p)
+ {
+ throw new XsltException (String.Format ("'{0}' element
is not supported as a template content in XSLT 1.0.", name), null);
+ }
+ }
+}
Modified:
trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslTemplateContent.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslTemplateContent.cs
2005-03-04 15:08:09 UTC (rev 41443)
+++ trunk/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslTemplateContent.cs
2005-03-04 15:29:21 UTC (rev 41444)
@@ -36,18 +36,30 @@
using System.Xml.XPath;
using System.Xml.Xsl;
-namespace Mono.Xml.Xsl.Operations {
- internal class XslTemplateContent : XslCompiledElement {
+namespace Mono.Xml.Xsl.Operations
+{
+ internal class XslTemplateContent : XslCompiledElementBase
+ {
ArrayList content = new ArrayList ();
bool hasStack;
int stackSize;
+ XPathNodeType parentType;
+ bool xslForEach;
- public XslTemplateContent (Compiler c, XPathNodeType parentType)
- : base (c, parentType)
+ public XslTemplateContent (Compiler c,
+ XPathNodeType parentType, bool xslForEach)
+ : base (c)
{
+ this.parentType = parentType;
+ this.xslForEach = xslForEach;
+ Compile (c);
}
+ public XPathNodeType ParentType {
+ get { return parentType; }
+ }
+
protected override void Compile (Compiler c)
{
hasStack = (c.CurrentVariableScope == null);
@@ -123,9 +135,15 @@
case "variable":
content.Add (new
XslLocalVariable (c));
break;
+ case "sort":
+ if (xslForEach)
+ break;
+ throw new
XsltCompileException ("'sort' element is not allowed here as a templete
content.", null, n);
default:
// TODO: handle
fallback, like we should
- throw new
XsltCompileException ("Did not recognize element " + n.Name, null, n);
+// throw new
XsltCompileException ("Did not recognize element " + n.Name, null, n);
+ content.Add (new
XslNotSupportedOperation (c));
+ break;
}
break;
default:
Modified: trunk/mcs/class/System.XML/System.Xml.dll.sources
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.dll.sources 2005-03-04 15:08:09 UTC
(rev 41443)
+++ trunk/mcs/class/System.XML/System.Xml.dll.sources 2005-03-04 15:29:21 UTC
(rev 41444)
@@ -40,6 +40,7 @@
Mono.Xml.Xsl.Operations/XslIf.cs
Mono.Xml.Xsl.Operations/XslLiteralElement.cs
Mono.Xml.Xsl.Operations/XslMessage.cs
+Mono.Xml.Xsl.Operations/XslNotSupportedOperation.cs
Mono.Xml.Xsl.Operations/XslNumber.cs
Mono.Xml.Xsl.Operations/XslOperation.cs
Mono.Xml.Xsl.Operations/XslProcessingInstruction.cs
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches