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>2008-01-08 08:02:44 +0300
committerAtsushi Eno <atsushieno@gmail.com>2008-01-08 08:02:44 +0300
commitea6e3df631113d6cddfb2dc0cd0ffe7d77e9800a (patch)
treeda33d5cfd99dc538f7c26e22e62e922cc3be1f02 /mcs/class/System.XML/Mono.Xml.Xsl
parent39e768aafa25e80ae3abcab6215e4b84eb038e41 (diff)
2008-01-08 Atsushi Enomoto <atsushi@ximian.com>
* XslKey.cs, XslStylesheet.cs, Compiler.cs : XSLT 1.0 does not prohibit more than one xsl:key with the same QName, so do not use the name as a 'key' in the table for xsl:key. Fixed bug #351939, patch by Tor Lillqvist. * XslTransformTests.cs : added test from bug #351939. (by Tor Lillqvist) svn path=/trunk/mcs/; revision=92426
Diffstat (limited to 'mcs/class/System.XML/Mono.Xml.Xsl')
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog7
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs8
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl/XslKey.cs22
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs11
4 files changed, 36 insertions, 12 deletions
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
index 56f0a161c9b..91397f8f170 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
+++ b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
@@ -1,3 +1,10 @@
+2008-01-08 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XslKey.cs, XslStylesheet.cs, Compiler.cs : XSLT 1.0 does not
+ prohibit more than one xsl:key with the same QName, so do not use
+ the name as a 'key' in the table for xsl:key. Fixed bug #351939,
+ patch by Tor Lillqvist.
+
2007-12-27 Atsushi Enomoto <atsushi@ximian.com>
* XslTemplate.cs, XslTransformProcessor.cs :
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs b/mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs
index 843037e2fd1..5efdaea300f 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs
@@ -91,9 +91,9 @@ namespace Mono.Xml.Xsl
return (XslGeneralVariable)globalVariables [name];
}
- public XslKey ResolveKey (QName name)
+ public ArrayList ResolveKey (QName name)
{
- return (XslKey) keys [name];
+ return (ArrayList) keys [name];
}
public XslAttributeSet ResolveAttributeSet (QName name)
@@ -426,7 +426,9 @@ namespace Mono.Xml.Xsl
public void AddKey (XslKey key)
{
- keys [key.Name] = key;
+ if (keys [key.Name] == null)
+ keys [key.Name] = new ArrayList ();
+ ((ArrayList) keys [key.Name]).Add (key);
}
public void AddAttributeSet (XslAttributeSet set)
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XslKey.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XslKey.cs
index 101bcaffea2..7b8b64a8001 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl/XslKey.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl/XslKey.cs
@@ -99,21 +99,27 @@ namespace Mono.Xml.Xsl
internal class KeyIndexTable
{
XsltCompiledContext ctx;
- XslKey key;
+ ArrayList keys;
Hashtable mappedDocuments;
- public KeyIndexTable (XsltCompiledContext ctx, XslKey key)
+ public KeyIndexTable (XsltCompiledContext ctx, ArrayList keys)
{
this.ctx = ctx;
- this.key = key;
+ this.keys = keys;
}
- public XslKey Key {
- get { return key; }
+ public ArrayList Keys {
+ get { return keys; }
}
private void CollectTable (XPathNavigator doc, XsltContext ctx, Hashtable map)
{
+ for (int i = 0; i < keys.Count; i++)
+ CollectTable (doc, ctx, map, (XslKey) keys[i]);
+ }
+
+ private void CollectTable (XPathNavigator doc, XsltContext ctx, Hashtable map, XslKey key)
+ {
XPathNavigator nav = doc.Clone ();
nav.MoveToRoot ();
XPathNavigator tmp = doc.Clone ();
@@ -160,6 +166,12 @@ namespace Mono.Xml.Xsl
private void CollectIndex (XPathNavigator nav, XPathNavigator target, Hashtable map)
{
+ for (int i = 0; i < keys.Count; i++)
+ CollectIndex (nav, target, map, (XslKey) keys[i]);
+ }
+
+ private void CollectIndex (XPathNavigator nav, XPathNavigator target, Hashtable map, XslKey key)
+ {
XPathNodeIterator iter;
switch (key.Use.ReturnType) {
case XPathResultType.NodeSet:
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs
index 1ee3be89201..31a488b7b81 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs
@@ -57,7 +57,7 @@ namespace Mono.Xml.Xsl {
NameValueCollection namespaceAliases = new NameValueCollection ();
// [QName]=>XmlSpace
Hashtable parameters = new Hashtable ();
- // [QName]=>XslKey
+ // [QName]=>ArrayList of XslKey
Hashtable keys = new Hashtable();
// [QName]=>XslVariable
Hashtable variables = new Hashtable ();
@@ -162,8 +162,9 @@ namespace Mono.Xml.Xsl {
foreach (XslGlobalVariable v in variables.Values)
c.AddGlobalVariable (v);
- foreach (XslKey key in keys.Values)
- c.AddKey (key);
+ foreach (ArrayList al in keys.Values)
+ for (int i = 0; i < al.Count; i++)
+ c.AddKey ((XslKey) al[i]);
c.PopStylesheet ();
inProcessIncludes = null;
@@ -436,7 +437,9 @@ namespace Mono.Xml.Xsl {
case "key":
XslKey key = new XslKey (c);
- keys [key.Name] = key;
+ if (keys [key.Name] == null)
+ keys [key.Name] = new ArrayList ();
+ ((ArrayList) keys [key.Name]).Add (key);
break;
case "output":