Hi dudie, So - of course this builds the frames on the exception - we could of course alternatively dump them to Debug.WriteLine [ or perhaps something easier to get at for the hacker without re-compiling mono ].
Either way, this turns my 100 line, unreadable barf into the appended, which I hope is much more useful (?) Patch attached, what do you think ? I'll try to catch you tomorrow on IRC to chew it over (?) :-) Thanks, Michael. [ERROR][/tmp/tst.docx] Conversion failed - Error during conversion [DEBUG][/tmp/tst.docx] Error during processing: at zip://localhost/word/document.xml(2,3076). from xsl:template child::http://schemas.openxmlformats.org/wordprocessingml/2006/main:p at assembly://localhost/content.xsl(336,46) from xsl:template child::http://schemas.openxmlformats.org/wordprocessingml/2006/main:p at assembly://localhost/content.xsl(244,29) from xsl:template child::http://schemas.openxmlformats.org/wordprocessingml/2006/main:tc at assembly://localhost/tables.xsl(80,30) from xsl:template child::http://schemas.openxmlformats.org/wordprocessingml/2006/main:tr at assembly://localhost/tables.xsl(57,30) from xsl:template child::http://schemas.openxmlformats.org/wordprocessingml/2006/main:tbl at assembly://localhost/tables.xsl(37,31) from xsl:template at assembly://localhost/content.xsl(55,32) from xsl:template self::node-type [Root]()/child::urn:oox:source at (51,6)( at Mono.Xml.Xsl.XslTemplate.Evaluate (Mono.Xml.Xsl.XslTransformProcessor p, System.Col lections.Hashtable withParams) [0x0010a] in /data/mono/mcs/class/System.XML/Mono.Xml.Xsl/XslTemplate.cs:412 at Mono.Xml.Xsl.XslTransformProcessor.ApplyTemplates (System.Xml.XPath.XPathNodeIterator nodes, System.Xml.XmlQualifiedName mode, System.Collections.ArrayLi st withParams) [0x0002e] in /data/mono/mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs:244 at Mono.Xml.Xsl.Operations.XslApplyTemplates.Evaluate (Mono.Xml.Xsl.XslTransformProcessor p) [0x0005a] in /data/mono/mcs/class/System.XML/Mono.Xml.Xsl.Opera tions/XslApplyTemplates.cs:105 at Mono.Xml.Xsl.Operations.XslTemplateContent.Evaluate (Mono.Xml.Xsl.XslTransformProcessor p) [0x0002a] in /data/mono/mcs/class/System.XML/Mono.Xml.Xsl.Oper ations/XslTemplateContent.cs:193 at Mono.Xml.Xsl.Operations.XslChoose.Evaluate (Mono.Xml.Xsl.XslTransformProcessor p) [0x00047] in /data/mono/mcs/class/System.XML/Mono.Xml.Xsl.Operations/Xs lChoose.cs:92 at Mono.Xml.Xsl.Operations.XslTemplateContent.Evaluate (Mono.Xml.Xsl.XslTransformProcessor p) [0x0002a] in /data/mono/mcs/class/System.XML/Mono.Xml.Xsl.Oper ations/XslTemplateContent.cs:193 at Mono.Xml.Xsl.XslTemplate.Evaluate (Mono.Xml.Xsl.XslTransformProcessor p, System.Collections.Hashtable withParams) [0x000ca] in /data/mono/mcs/class/Syste m.XML/Mono.Xml.Xsl/XslTemplate.cs:403 ) Done. -- [EMAIL PROTECTED] <><, Pseudo Engineer, itinerant idiot
Index: class/System.XML/System.Xml.Xsl/XsltException.cs =================================================================== --- class/System.XML/System.Xml.Xsl/XsltException.cs (revision 67841) +++ class/System.XML/System.Xml.Xsl/XsltException.cs (working copy) @@ -64,6 +64,7 @@ int lineNumber; int linePosition; string sourceUri; + string xsltFrames; #endregion @@ -132,7 +133,10 @@ public override string Message { get { - return base.Message; + string msg = base.Message; + if (xsltFrames != null) + msg += xsltFrames; + return msg; } } @@ -157,6 +161,11 @@ info.AddValue ("sourceUri", sourceUri); } + public void appendXsltFrame( string msg ) + { + xsltFrames += msg; + } + #endregion } } Index: class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs =================================================================== --- class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs (revision 67841) +++ class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs (working copy) @@ -66,6 +66,7 @@ // stylesheet attributes string version; + string baseURI; XmlQualifiedName [] extensionElementPrefixes; XmlQualifiedName [] excludeResultPrefixes; ArrayList stylesheetNamespaces = new ArrayList (); @@ -111,6 +112,10 @@ get { return version; } } + public string BaseURI { + get { return baseURI; } + } + public XslStylesheet () { } @@ -121,6 +126,8 @@ templates = new XslTemplateTable (this); + baseURI = c.Input.BaseURI; + // move to root element while (c.Input.NodeType != XPathNodeType.Element) if (!c.Input.MoveToNext ()) Index: class/System.XML/Mono.Xml.Xsl/XslTemplate.cs =================================================================== --- class/System.XML/Mono.Xml.Xsl/XslTemplate.cs (revision 67841) +++ class/System.XML/Mono.Xml.Xsl/XslTemplate.cs (working copy) @@ -350,11 +360,19 @@ c.Input.MoveToParent (); } } - + + void accumulateFrames(XsltException ex) + { + XslCompiledElementBase op = (XslCompiledElementBase) content; + ex.appendXsltFrame(" from\nxsl:template " + Match + " at " + + style.BaseURI + "(" + op.LineNumber + "," + op.LinePosition + ")"); + } + public virtual void Evaluate (XslTransformProcessor p, Hashtable withParams) { p.PushStack (stackSize); + try { if (parameters != null) { if (withParams == null) { int len = parameters.Count; @@ -374,10 +398,20 @@ } } } - + if (content != null) content.Evaluate (p); + } catch (XsltException ex) { + accumulateFrames (ex); + throw ex; + } catch (Exception ex) { + XsltException e = new XsltException ("Error during XSLT processing: ", + null, p.CurrentNode); + accumulateFrames (e); + throw e; + } + p.PopStack (); } public void Evaluate (XslTransformProcessor p)
_______________________________________________ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list