Explorar el Código

2006-04-07 Atsushi Enomoto <[email protected]>

	* XslTransformProcessor.cs : push current node context after iterating
	  template target node. Added another NodesetMoveNext() which takes
	  explicit XPathNodeIterator to iterate and filter whitespaces out.

	* XslForEach.cs : push current node context after iterating "selected"
	  node-set.

	* XslTransformTests.cs : added CurrentInSelect().

	* current-in-select.xml current-in-select.xsl current-in-select.ref :
	  new files for XslTransformTests.CurrentInSelect().


svn path=/trunk/mcs/; revision=59172
Atsushi Eno hace 20 años
padre
commit
f7ec99dca7

+ 5 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog

@@ -1,3 +1,8 @@
+2005-04-07  Atsushi Enomoto  <[email protected]>
+
+	* XslForEach.cs : push current node context after iterating "selected"
+	  node-set.
+
 2005-03-15  Atsushi Enomoto  <[email protected]>
 
 	* XslApplyTemplates.cs, XslSort.cs : use new XslSortEvaluator.cs

+ 6 - 5
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslForEach.cs

@@ -85,13 +85,14 @@ namespace Mono.Xml.Xsl.Operations {
 				sortEvaluator.SortedSelect (p) :
 				p.Select (select);
 
-			p.PushNodeset (iter);
-			p.PushForEachContext ();
 			
-			while (p.NodesetMoveNext ())
+			while (p.NodesetMoveNext (iter)) {
+				p.PushNodeset (iter);
+				p.PushForEachContext ();
 				children.Evaluate (p);
-			p.PopForEachContext();
-			p.PopNodeset ();
+				p.PopForEachContext();
+				p.PopNodeset ();
+			}
 		}
 	}
 }

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog

@@ -1,3 +1,9 @@
+2006-04-07  Atsushi Enomoto  <[email protected]>
+
+	* XslTransformProcessor.cs : push current node context after iterating
+	  template target node. Added another NodesetMoveNext() which takes
+	  explicit XPathNodeIterator to iterate and filter whitespaces out.
+
 2006-04-07  Atsushi Enomoto  <[email protected]>
 
 	* XslTransformProcessor.cs : in NodesetMoveNext() take

+ 12 - 7
mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs

@@ -237,14 +237,14 @@ namespace Mono.Xml.Xsl {
 
 			Hashtable passedParams = GetParams (withParams);
 			
-			PushNodeset (nodes);
-			while (NodesetMoveNext ()) {
+			while (NodesetMoveNext (nodes)) {
+				PushNodeset (nodes);
 				XslTemplate t = FindTemplate (CurrentNode, mode);
 				currentTemplateStack.Push (t);
 				t.Evaluate (this, passedParams);
 				currentTemplateStack.Pop ();
+				PopNodeset ();
 			}
-			PopNodeset ();
 			
 			if (passedParams != null) paramPassingCache.Push (passedParams);
 		}
@@ -442,13 +442,18 @@ namespace Mono.Xml.Xsl {
 		
 		public bool NodesetMoveNext ()
 		{
-			if (!CurrentNodeset.MoveNext ())
+			return NodesetMoveNext (CurrentNodeset);
+		}
+
+		public bool NodesetMoveNext (XPathNodeIterator iter)
+		{
+			if (!iter.MoveNext ())
 				return false;
-			if (CurrentNodeset.Current.NodeType == XPathNodeType.Whitespace && !XPathContext.PreserveWhitespace (CurrentNodeset.Current))
-				return NodesetMoveNext ();
+			if (iter.Current.NodeType == XPathNodeType.Whitespace && !XPathContext.PreserveWhitespace (iter.Current))
+				return NodesetMoveNext (iter);
 			return true;
 		}
-		
+
 		public void PushNodeset (XPathNodeIterator itr)
 		{
 			nodesetStack.Add (itr);

+ 4 - 0
mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog

@@ -1,3 +1,7 @@
+2006-04-07  Atsushi Enomoto  <[email protected]>
+
+	* XslTransformTests.cs : added CurrentInSelect().
+
 2006-04-07  Atsushi Enomoto  <[email protected]>
 
 	* XslTransformTests.cs : added StripSpace().

+ 16 - 0
mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs

@@ -1898,5 +1898,21 @@ Services
 			t.Transform (d, null, sw);
 			Assert.AreEqual (result, sw.ToString ());
 		}
+
+		[Test]
+		public void CurrentInSelect ()
+		{
+			XslTransform t = new XslTransform ();
+			t.Load ("Test/XmlFiles/xsl/current-in-select.xsl");
+			XPathDocument d = new XPathDocument (
+				"Test/XmlFiles/xsl/current-in-select.xml", XmlSpace.Preserve);
+			StringWriter sw = new StringWriter ();
+			t.Transform (d, null, sw);
+			using (StreamReader sr = File.OpenText (
+			       "Test/XmlFiles/xsl/current-in-select.ref")) {
+				string s = sr.ReadToEnd ();
+				Assert.AreEqual (s, sw.ToString ());
+			}
+		}
 	}
 }

+ 5 - 0
mcs/class/System.XML/Test/XmlFiles/xsl/ChangeLog

@@ -1,3 +1,8 @@
+2006-04-07  Atsushi Enomoto <[email protected]>
+
+	* current-in-select.xml current-in-select.xsl current-in-select.ref :
+	  new files for XslTransformTests.CurrentInSelect().
+
 2006-04-07  Atsushi Enomoto <[email protected]>
 
 	* stripspace.xml, stripspace.xsl : added strip-space testcases.

+ 45 - 0
mcs/class/System.XML/Test/XmlFiles/xsl/current-in-select.ref

@@ -0,0 +1,45 @@
+
+	== MonoDevelop.Ide ==
+	ProjectTemplates,
+	FileTemplates,
+	StartupHandlers,
+	FileTemplateTypes,
+	DisplayBindings,
+	MainMenu,
+	Pads,
+	ToolBar,
+	Contexts,
+	FileFilter,
+	DefaultDirectoryNode,
+	ReferenceFolderNode,
+	SystemFileNode,
+	ReferenceNode,
+	ProjectFileNode,
+	ResourceFolderNode,
+	CombineBrowserNode,
+	ProjectBrowserNode,
+	OptionsDialog,
+	Commands,
+	
+	== MonoDevelop.Projects.Gui ==
+	ConfigurationProperties,
+	GeneralOptions,
+	ConfigurationProperties,
+	GeneralOptions,
+	
+	== MonoDevelop.Projects ==
+	ProjectBindings,
+	SerializableClasses,
+	BuildPipeline,
+	Ambiences,
+	ExtendedProperties,
+	ProjectFileFormats,
+	
+	== MonoDevelop.Core.Gui ==
+	StockIcons,
+	
+	== MonoDevelop.Core ==
+	ExecutionHandlers,
+	Applications,
+	Services,
+	

+ 80 - 0
mcs/class/System.XML/Test/XmlFiles/xsl/current-in-select.xml

@@ -0,0 +1,80 @@
+<Tree>
+    <Node name="">
+      <Node name="MonoDevelop">
+        <Node name="ProjectTemplates" idref="ProjectTemplates" title="Project templates to be shown in the New Project dialog." description="Project templates to be shown in the New Project dialog." add-in="MonoDevelop.Ide" />
+        <Node name="FileTemplates" idref="FileTemplates" title="File templates to be shown in the New File dialog." description="File templates to be shown in the New File dialog." add-in="MonoDevelop.Ide" />
+        <Node name="IDE">
+          <Node name="StartupHandlers" idref="StartupHandlers" title="Commands to be automatically executed when the IDE starts. Specified classes must subclass MonoDevelop.Components.Commands.CommandHandler." description="Commands to be automatically executed when the IDE starts. Specified classes must subclass MonoDevelop.Components.Commands.CommandHandler." add-in="MonoDevelop.Ide" />
+        </Node>
+        <Node name="FileTemplateTypes" idref="FileTemplateTypes" title="Template types which can be used to create file templates." description="Template types which can be used to create file templates." add-in="MonoDevelop.Ide" />
+      </Node>
+      <Node name="SharpDevelop">
+        <Node name="Workbench">
+          <Node name="ProjectOptions">
+            <Node name="ConfigurationProperties" idref="ConfigurationProperties" title="Dialog panels for project configuration options." description="Dialog panels for project configuration options." add-in="MonoDevelop.Projects.Gui" />
+            <Node name="GeneralOptions" idref="GeneralOptions" title="Dialog panels for project options." description="Dialog panels for project options." add-in="MonoDevelop.Projects.Gui" />
+          </Node>
+          <Node name="CombineOptions">
+            <Node name="ConfigurationProperties" idref="ConfigurationProperties" title="Dialog panels for solution configuration options." description="Dialog panels for solution configuration options." add-in="MonoDevelop.Projects.Gui" />
+            <Node name="GeneralOptions" idref="GeneralOptions" title="Dialog panels for solution options." description="Dialog panels for solution options." add-in="MonoDevelop.Projects.Gui" />
+          </Node>
+          <Node name="DisplayBindings" idref="DisplayBindings" title="Display bindings." description="Display bindings." add-in="MonoDevelop.Ide" />
+          <Node name="ProjectBindings" idref="ProjectBindings" title="Project bindings." description="Project bindings." add-in="MonoDevelop.Projects" />
+          <Node name="MainMenu" idref="MainMenu" title="The main menu." description="The main menu." add-in="MonoDevelop.Ide" />
+          <Node name="SerializableClasses" idref="SerializableClasses" title="Classes to be registered for serialization." description="Classes to be registered for serialization." add-in="MonoDevelop.Projects" />
+          <Node name="Pads" idref="Pads" title="Pads shown in the workbench." description="Pads shown in the workbench." add-in="MonoDevelop.Ide">
+            <Node name="MonoDevelop.Ide.Gui.Pads.ClassPad" idref="MonoDevelop.Ide.Gui.Pads.ClassPad" title="Registers a pad which shows information about a project in a tree view." description="Registers a pad which shows information about a project in a tree view." />
+            <Node name="MonoDevelop.Ide.Gui.Pads.ProjectPad" idref="MonoDevelop.Ide.Gui.Pads.ProjectPad" title="Registers a pad which shows information about a project in a tree view." description="Registers a pad which shows information about a project in a tree view." />
+          </Node>
+          <Node name="BuildPipeline" idref="BuildPipeline" title="Custom build steps. Specified classes must implement IBuildStep" description="Custom build steps. Specified classes must implement IBuildStep" add-in="MonoDevelop.Projects" />
+          <Node name="ToolBar" idref="ToolBar" title="The main toolbar." description="The main toolbar." add-in="MonoDevelop.Ide" />
+          <Node name="Contexts" idref="Contexts" title="Workbench contexts." description="Workbench contexts." add-in="MonoDevelop.Ide" />
+          <Node name="FileFilter" idref="FileFilter" title="File filters for the Open File dialog." description="File filters for the Open File dialog." add-in="MonoDevelop.Ide" />
+          <Node name="StockIcons" idref="StockIcons" title="Stock icons (available from MonoDevelop.Core.Gui.Services.Resources)." description="Stock icons (available from MonoDevelop.Core.Gui.Services.Resources)." add-in="MonoDevelop.Core.Gui" />
+          <Node name="Combine">
+            <Node name="FileFilter" />
+          </Node>
+          <Node name="Ambiences" idref="Ambiences" title="Language ambiences. Specified classes must implement IAmbience." description="Language ambiences. Specified classes must implement IAmbience." add-in="MonoDevelop.Projects" />
+          <Node name="Serialization">
+            <Node name="ExtendedProperties" idref="ExtendedProperties" title="Custom properties for projects and other types." description="Custom properties for projects and other types." add-in="MonoDevelop.Projects" />
+          </Node>
+          <Node name="ProjectFileFormats" idref="ProjectFileFormats" title="File format handlers for projects and solutions." description="File format handlers for projects and solutions." add-in="MonoDevelop.Projects" />
+          <Node name="ExecutionHandlers" idref="ExecutionHandlers" title="Default execution handlers." description="Default execution handlers." add-in="MonoDevelop.Core" />
+        </Node>
+        <Node name="Views">
+          <Node name="ProjectBrowser">
+            <Node name="ContextMenu">
+              <Node name="DefaultDirectoryNode" idref="DefaultDirectoryNode" title="Context menu for a folder in the solution pad." description="Context menu for a folder in the solution pad." add-in="MonoDevelop.Ide" />
+              <Node name="ReferenceFolderNode" idref="ReferenceFolderNode" title="Context menu for the references folder in the solution pad." description="Context menu for the references folder in the solution pad." add-in="MonoDevelop.Ide" />
+              <Node name="SystemFileNode" idref="SystemFileNode" title="Context menu for a file (not belonging to a project) in the solution pad." description="Context menu for a file (not belonging to a project) in the solution pad." add-in="MonoDevelop.Ide" />
+              <Node name="ReferenceNode" idref="ReferenceNode" title="Context menu for a reference in the solution pad." description="Context menu for a reference in the solution pad." add-in="MonoDevelop.Ide" />
+              <Node name="ProjectFileNode" idref="ProjectFileNode" title="Context menu for a project file in the solution pad." description="Context menu for a project file in the solution pad." add-in="MonoDevelop.Ide" />
+              <Node name="ResourceFolderNode" idref="ResourceFolderNode" title="Context menu for the resource folder in the solution pad." description="Context menu for the resource folder in the solution pad." add-in="MonoDevelop.Ide" />
+              <Node name="CombineBrowserNode" idref="CombineBrowserNode" title="Context menu for solutions in the solution pad." description="Context menu for solutions in the solution pad." add-in="MonoDevelop.Ide" />
+              <Node name="ProjectBrowserNode" idref="ProjectBrowserNode" title="Context menu for a project in the solution pad." description="Context menu for a project in the solution pad." add-in="MonoDevelop.Ide" />
+            </Node>
+          </Node>
+        </Node>
+        <Node name="DefaultEditor">
+          <Node name="SearchAndReplace">
+            <Node name="WildcardHelpPath" />
+          </Node>
+        </Node>
+        <Node name="Dialogs">
+          <Node name="OptionsDialog" idref="OptionsDialog" title="Dialog panels for global MonoDevelop options." description="Dialog panels for global MonoDevelop options." add-in="MonoDevelop.Ide" />
+        </Node>
+        <Node name="Commands" idref="Commands" title="User interface commands." description="User interface commands." add-in="MonoDevelop.Ide" />
+      </Node>
+      <Node name="Workspace">
+        <Node name="Applications" idref="Applications" title="Applications managed by the runtime. Those application can be started using mdtool. Specified classes must implement MonoDevelop.Core.AddIns.IApplication." description="Applications managed by the runtime. Those application can be started using mdtool. Specified classes must implement MonoDevelop.Core.AddIns.IApplication." add-in="MonoDevelop.Core" />
+        <Node name="Services" idref="Services" title="Services to be initialized by the runtime. Specified classes must implement MonoDevelop.Core.IService" description="Services to be initialized by the runtime. Specified classes must implement MonoDevelop.Core.IService" add-in="MonoDevelop.Core" />
+      </Node>
+    </Node>
+  <AddIns>
+    <AddIn name="MonoDevelop.Ide" />
+    <AddIn name="MonoDevelop.Projects.Gui" />
+    <AddIn name="MonoDevelop.Projects" />
+    <AddIn name="MonoDevelop.Core.Gui" />
+    <AddIn name="MonoDevelop.Core" />
+  </AddIns>
+</Tree>

+ 14 - 0
mcs/class/System.XML/Test/XmlFiles/xsl/current-in-select.xsl

@@ -0,0 +1,14 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="html" indent="no" />
+
+<xsl:template match="/">
+<xsl:for-each select="Tree/AddIns/AddIn">
+	== <xsl:value-of select="@name"/> ==
+	<xsl:for-each select="/Tree/Node//*[@add-in=current()/@name]">
+		<xsl:value-of select="@name"/>,
+	</xsl:for-each>
+</xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>
+