diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2005-07-29 17:14:51 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2005-07-29 17:14:51 +0400 |
commit | f2134e09c25796f8aca226bab0eaea9aa2e3baba (patch) | |
tree | f149334eccfa5ca91311f30db29ce70ad76c300f /mcs/class/System.XML/Mono.Xml.Xsl | |
parent | cd5e4a428e21aa9969285b38be8b955861cb1c60 (diff) |
2005-07-29 Atsushi Enomoto <atsushi@ximian.com>
* XslFunctions.cs : XslTransform recovers from errors on document
resolution. Fixed bug #75663.
* XslTransformTests.cs : added testcase for bug #75663.
svn path=/trunk/mcs/; revision=47843
Diffstat (limited to 'mcs/class/System.XML/Mono.Xml.Xsl')
-rw-r--r-- | mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/System.XML/Mono.Xml.Xsl/XslFunctions.cs | 50 |
2 files changed, 35 insertions, 20 deletions
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog index 64f2fc976b9..876d002c67a 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog +++ b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog @@ -1,3 +1,8 @@ +2005-07-29 Atsushi Enomoto <atsushi@ximian.com> + + * XslFunctions.cs : XslTransform recovers from errors on document + resolution. Fixed bug #75663. + 2005-06-06 Atsushi Enomoto <atsushi@ximian.com> * HtmlEmitter.cs : Boolean attribute values should be omitted, but diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XslFunctions.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XslFunctions.cs index 1c8d068a242..cf061cc472f 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/XslFunctions.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl/XslFunctions.cs @@ -262,35 +262,45 @@ namespace Mono.Xml.Xsl XPathNodeIterator GetDocument (XsltCompiledContext xsltContext, XPathNodeIterator itr, string baseUri) { ArrayList list = new ArrayList (); - Hashtable got = new Hashtable (); + try { + Hashtable got = new Hashtable (); - while (itr.MoveNext()) { - Uri uri = Resolve (itr.Current.Value, baseUri != null ? baseUri : /*itr.Current.BaseURI*/doc.BaseURI, xsltContext.Processor); - if (!got.ContainsKey (uri)) { - got.Add (uri, null); - if (uri != null && uri.ToString () == "") { - XPathNavigator n = doc.Clone (); - n.MoveToRoot (); - list.Add (n); - } else - list.Add (xsltContext.Processor.GetDocument (uri)); + while (itr.MoveNext()) { + Uri uri = Resolve (itr.Current.Value, baseUri != null ? baseUri : /*itr.Current.BaseURI*/doc.BaseURI, xsltContext.Processor); + if (!got.ContainsKey (uri)) { + got.Add (uri, null); + if (uri != null && uri.ToString () == "") { + XPathNavigator n = doc.Clone (); + n.MoveToRoot (); + list.Add (n); + } else + list.Add (xsltContext.Processor.GetDocument (uri)); + } } + } catch (Exception) { + // Error recovery. + // See http://www.w3.org/TR/xslt#document and + // bug #75663. + list.Clear (); } - return new ListIterator (list, xsltContext); } XPathNodeIterator GetDocument (XsltCompiledContext xsltContext, string arg0, string baseUri) { - Uri uri = Resolve (arg0, baseUri != null ? baseUri : doc.BaseURI, xsltContext.Processor); - XPathNavigator n; - if (uri != null && uri.ToString () == "") { - n = doc.Clone (); - n.MoveToRoot (); - } else - n = xsltContext.Processor.GetDocument (uri); + try { + Uri uri = Resolve (arg0, baseUri != null ? baseUri : doc.BaseURI, xsltContext.Processor); + XPathNavigator n; + if (uri != null && uri.ToString () == "") { + n = doc.Clone (); + n.MoveToRoot (); + } else + n = xsltContext.Processor.GetDocument (uri); - return new SelfIterator (n, xsltContext); + return new SelfIterator (n, xsltContext); + } catch (Exception) { + return new ListIterator (new ArrayList (), xsltContext); + } } public override string ToString () |