Author: atsushi
Date: 2005-03-03 05:25:58 -0500 (Thu, 03 Mar 2005)
New Revision: 41390

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
Log:
2005-03-03  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * XslStylesheet.cs, XslTransformProcessor.cs : exclude-element-prefix
          in stylesheet should be considered in TryElementNamespacesOutput().
          ParseQNameListAttribute() is not properly working for filling
          namespaces.



Modified: trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog   2005-03-03 10:19:14 UTC 
(rev 41389)
+++ trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog   2005-03-03 10:25:58 UTC 
(rev 41390)
@@ -1,3 +1,10 @@
+2005-03-03  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * XslStylesheet.cs, XslTransformProcessor.cs : exclude-element-prefix
+         in stylesheet should be considered in TryElementNamespacesOutput().
+         ParseQNameListAttribute() is not properly working for filling
+         namespaces.
+
 2005-03-02  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * XslStylesheet.cs : included stylesheet could be literal result 

Modified: trunk/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs    2005-03-03 
10:19:14 UTC (rev 41389)
+++ trunk/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs    2005-03-03 
10:25:58 UTC (rev 41390)
@@ -145,8 +145,8 @@
                                if (version == String.Empty)
                                        throw new XsltCompileException 
("Mandatory attribute version is missing.", null, c.Input);
 
-                               extensionElementPrefixes = 
c.ParseQNameListAttribute ("extension-element-prefixes");
-                               excludeResultPrefixes = 
c.ParseQNameListAttribute ("exclude-result-prefixes");
+                               extensionElementPrefixes = ParseMappedPrefixes 
(c.GetAttribute ("extension-element-prefixes"), c.Input);
+                               excludeResultPrefixes = ParseMappedPrefixes 
(c.GetAttribute ("exclude-result-prefixes"), c.Input);
                                if (c.Input.MoveToFirstNamespace 
(XPathNamespaceScope.Local)) {
                                        do {
                                                if (c.Input.Value == 
XsltNamespace)
@@ -160,7 +160,26 @@
                        
                        c.PopStylesheet ();
                }
-               
+
+               private QName [] ParseMappedPrefixes (string list, 
XPathNavigator nav)
+               {
+                       if (list == null)
+                               return null;
+                       ArrayList al = new ArrayList ();
+                       foreach (string entry in list.Split 
(XmlChar.WhitespaceChars)) {
+                               if (entry.Length == 0)
+                                       continue;
+                               if (entry == "#default")
+                                       al.Add (new QName (String.Empty, 
String.Empty));
+                               else {
+                                       string entryNS = nav.GetNamespace 
(entry);
+                                       if (entryNS != String.Empty)
+                                               al.Add (new QName (entry, 
entryNS));
+                               }
+                       }
+                       return (QName []) al.ToArray (typeof (QName));
+               }
+
                public XslKey FindKey (QName name)
                {
                        XslKey key = Keys [name] as XslKey;

Modified: trunk/mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs    
2005-03-03 10:19:14 UTC (rev 41389)
+++ trunk/mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs    
2005-03-03 10:25:58 UTC (rev 41390)
@@ -339,6 +339,19 @@
                                        XPathContext.ElementNamespace.Length == 
0)
                                        continue;
 
+                               // exclude-result-prefixes, see the spec 7.1.1
+                               bool skip = false;
+                               if (style.ExcludeResultPrefixes != null) {
+                                       foreach (XmlQualifiedName exc in 
style.ExcludeResultPrefixes) {
+                                               if (exc.Namespace == value) {
+                                                       skip = true;
+                                                       continue;
+                                               }
+                                       }
+                               }
+                               if (skip)
+                                       continue;
+
                                if (style.NamespaceAliases [name] != null)
                                        continue;
 

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

Reply via email to