Author: atsushi
Date: 2005-03-09 17:52:38 -0500 (Wed, 09 Mar 2005)
New Revision: 41620

Modified:
   trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
   trunk/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs
   trunk/mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs
   trunk/mcs/class/System.XML/Mono.Xml.Xsl/XsltCompiledContext.cs
Log:
2005-03-09  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * XslStylesheet.cs, XslCompiledContext.cs : Fixed PreserveWhitespace()
          to work fine with xsl:*-space attributes as expected.
        * XslTransformProcessor.cs : PreserveWhitespace() in this file is 
          actually nothing. It should not use XsltContext.PreserveWhitespace()
          because this method is used to control output, while the referenced
          method is used to control source document.




Modified: trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog   2005-03-09 22:50:12 UTC 
(rev 41619)
+++ trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog   2005-03-09 22:52:38 UTC 
(rev 41620)
@@ -1,5 +1,14 @@
 2005-03-09  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
+       * XslStylesheet.cs, XslCompiledContext.cs : Fixed PreserveWhitespace()
+         to work fine with xsl:*-space attributes as expected.
+       * XslTransformProcessor.cs : PreserveWhitespace() in this file is 
+         actually nothing. It should not use XsltContext.PreserveWhitespace()
+         because this method is used to control output, while the referenced
+         method is used to control source document.
+
+2005-03-09  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
        * XslTemplate.cs : First non-element content were incorrectly ignored.
 
 2005-03-09  Atsushi Enomoto  <[EMAIL PROTECTED]>

Modified: trunk/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs    2005-03-09 
22:50:12 UTC (rev 41619)
+++ trunk/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs    2005-03-09 
22:52:38 UTC (rev 41620)
@@ -202,15 +202,19 @@
                        }
                }
 
-               public bool GetPreserveWhitespace (string localName, string ns)
+               QName allMatchName = new QName ("*");
+
+               public bool GetPreserveWhitespace (XPathNavigator nav)
                {
                        if (!HasSpaceControls)
                                return true;
 
+                       string localName = nav.LocalName;
+                       string ns = nav.NamespaceURI;
+
                        XmlQualifiedName qname = new XmlQualifiedName 
(localName, ns);
                        object o = spaceControls [qname];
                        if (o == null) {
-
                                for (int i = 0; i < imports.Count; i++) {
                                        o = ((XslStylesheet) imports 
[i]).SpaceControls [qname];
                                        if (o != null)
@@ -231,8 +235,7 @@
                        }
 
                        if (o == null) {
-                               qname = new XmlQualifiedName ("*", 
String.Empty);
-                               o = spaceControls [qname];
+                               o = spaceControls [allMatchName];
                                if (o == null) {
                                        for (int i = 0; i < imports.Count; i++) 
{
                                                o = ((XslStylesheet) imports 
[i]).SpaceControls [qname];
@@ -250,6 +253,9 @@
                                        return false;
                                }
                        }
+                       if (nav.MoveToParent () &&
+                               nav.NodeType == XPathNodeType.Element)
+                               return GetPreserveWhitespace (nav);
                        return true;
                }
 

Modified: trunk/mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs    
2005-03-09 22:50:12 UTC (rev 41619)
+++ trunk/mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs    
2005-03-09 22:52:38 UTC (rev 41620)
@@ -582,7 +582,7 @@
                        bool b = IsCData (name, ns);
                        XPathContext.PushScope ();
                        Out.InsideCDataSection = XPathContext.IsCData = b;
-                       XPathContext.WhitespaceHandling = preserveWhitespace;
+                       XPathContext.WhitespaceHandling = 
true;//preserveWhitespace;
                        XPathContext.ElementPrefix = prefix;
                        XPathContext.ElementNamespace = ns;
                        return b;
@@ -607,7 +607,8 @@
 
                public bool PreserveWhitespace ()
                {
-                       return XPathContext.PreserveWhitespace (CurrentNode);
+//                     return XPathContext.PreserveWhitespace (CurrentNode);
+                       return XPathContext.Whitespace;
                }
        }
 }

Modified: trunk/mcs/class/System.XML/Mono.Xml.Xsl/XsltCompiledContext.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Xsl/XsltCompiledContext.cs      
2005-03-09 22:50:12 UTC (rev 41619)
+++ trunk/mcs/class/System.XML/Mono.Xml.Xsl/XsltCompiledContext.cs      
2005-03-09 22:52:38 UTC (rev 41620)
@@ -176,7 +176,7 @@
 
                public override bool PreserveWhitespace (XPathNavigator nav) 
                {
-                       return p.CompiledStyle.Style.GetPreserveWhitespace 
(nav.LocalName, nav.NamespaceURI);
+                       return p.CompiledStyle.Style.GetPreserveWhitespace 
(nav.Clone ());
                }
 
                public override bool Whitespace { get { return 
WhitespaceHandling; } }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to