Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2005-02-16 15:56:46 +0300
committerAtsushi Eno <atsushieno@gmail.com>2005-02-16 15:56:46 +0300
commit8d497e6f32fd06c2916a1abff97d82d2c96c16f9 (patch)
tree0c7eff97b70fb43820262312da04626fc6bd1917 /mcs/class/System.XML/Mono.Xml.Xsl.Operations
parent91c7dca74c0e31f099eb346f9913e76028e7433c (diff)
2005-02-16 Atsushi Enomoto <atsushi@ximian.com>
* Compiler.cs : GetNamespacesToCopy() should also find for non-local namespace nodes. Patch by Andrew Skiba with some fixes. * XslTransformProcessor.cs : Patch by Andrew Skiba. TryStylesheetNamespaceOutput() is now TryElementNamespacesOutput() as to handle all namespace nodes to copy in stylesheet nodes. Global parameterss are evaluated before global variables. * XmlOutputter.cs : removed unused code. * XslCopy.cs : According to the spec 7.5, namespace nodes should be copied. Patch by Andrew Skiba. * XslLiteralElement.cs, XslElement.cs : Change in sync with TryElementNamespacesOutput(). * XslStylesheet.cs : version check was incorrectly done. Should check empty string, not null. Pending items: * Actually variables and params should check reference recursion. This patch incompletely fixes the problem. * Those operations that considers excluded-result-prefixes must also check those attributes of its ancestors. svn path=/trunk/mcs/; revision=40745
Diffstat (limited to 'mcs/class/System.XML/Mono.Xml.Xsl.Operations')
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog9
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopy.cs16
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslElement.cs2
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs4
4 files changed, 27 insertions, 4 deletions
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog
index 9ed874bf8df..8af0ed50ca0 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog
+++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog
@@ -1,3 +1,12 @@
+2005-02-16 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XslCopy.cs : According to the spec 7.5, namespace nodes should be
+ copied. Patch by Andrew Skiba.
+ * XslLiteralElement.cs,
+ XslElement.cs : Change in sync with TryElementNamespacesOutput().
+ * XslStylesheet.cs : version check was incorrectly done.
+ Should check empty string, not null.
+
2005-02-15 Atsushi Enomoto <atsushi@ximian.com>
* XslMessage.cs, XslOperation.cs, XslAttribute.cs, XslComment.cs,
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopy.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopy.cs
index ee53249bdd4..849f913b5bf 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopy.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopy.cs
@@ -40,12 +40,24 @@ namespace Mono.Xml.Xsl.Operations {
internal class XslCopy : XslCompiledElement {
XslOperation children;
XmlQualifiedName [] useAttributeSets;
+ Hashtable nsDecls;
+ ArrayList excludedPrefixes;
public XslCopy (Compiler c) : base (c) {}
protected override void Compile (Compiler c)
{
- if (c.Input.MoveToFirstAttribute ()) {
+ this.nsDecls = c.GetNamespacesToCopy ();
+ if (nsDecls.Count == 0) nsDecls = null;
+ string excludeResultPrefixes;
+ string extensionElementPrefixes;
+ excludeResultPrefixes = c.Input.GetAttribute ("exclude-result-prefixes", XsltNamespace);
+ extensionElementPrefixes = c.Input.GetAttribute ("extension-element-prefixes", XsltNamespace);
+ excludedPrefixes = new ArrayList (excludeResultPrefixes.Split (XmlChar.WhitespaceChars));
+ excludedPrefixes.AddRange (extensionElementPrefixes.Split (XmlChar.WhitespaceChars));
+
+ if (c.Input.MoveToFirstAttribute ())
+ {
do {
if (c.Input.NamespaceURI == String.Empty && c.Input.LocalName != "use-attribute-sets")
throw new XsltCompileException ("Unrecognized attribute \"" + c.Input.Name + "\" in XSLT copy element.", null, c.Input);
@@ -80,7 +92,7 @@ namespace Mono.Xml.Xsl.Operations {
p.PushElementState (p.CurrentNode.LocalName, p.CurrentNode.NamespaceURI, true);
p.Out.WriteStartElement (p.CurrentNode.Prefix, p.CurrentNode.LocalName, p.CurrentNode.NamespaceURI);
- p.TryStylesheetNamespaceOutput (null);
+ p.TryElementNamespacesOutput (nsDecls, excludedPrefixes);
if (useAttributeSets != null)
foreach (XmlQualifiedName s in useAttributeSets)
p.ResolveAttributeSet (s).Evaluate (p);
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslElement.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslElement.cs
index d89098ddb15..8b0bb7ee07e 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslElement.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslElement.cs
@@ -122,7 +122,7 @@ namespace Mono.Xml.Xsl.Operations {
bool isCData = p.InsideCDataElement;
p.PushElementState (localName, nmsp, false);
p.Out.WriteStartElement (prefix, localName, nmsp);
- p.TryStylesheetNamespaceOutput (null);
+ p.TryElementNamespacesOutput (null, null);
if (useAttributeSets != null)
foreach (XmlQualifiedName s in useAttributeSets)
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs
index beb94657d50..9c67afa2672 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs
@@ -67,6 +67,7 @@ namespace Mono.Xml.Xsl.Operations {
public void Evaluate (XslTransformProcessor p)
{
+ //FIXME: fix attribute prefixes according to aliases
p.Out.WriteAttributeString (prefix, localname, nsUri, val.Evaluate (p));
}
}
@@ -139,7 +140,8 @@ namespace Mono.Xml.Xsl.Operations {
((XslLiteralAttribute)attrs [i]).Evaluate (p);
}
- p.TryStylesheetNamespaceOutput (excludedPrefixes);
+ p.TryElementNamespacesOutput (nsDecls, excludedPrefixes);
+
if (nsDecls != null) {
foreach (DictionaryEntry de in nsDecls) {
string actualPrefix = p.CompiledStyle.Style.PrefixInEffect (de.Key as String, excludedPrefixes);