[Mono-dev] Possible bug in xslt extension object

Steen Manniche stm at dbc.dk
Sat Aug 18 07:03:22 EDT 2007


Hi there,

While building an XmlTransformation class that can embed external objects into the xsl transformation process via System.Xml.Xsl.XsltArgumentList I've hit a possible bug in the mono stack. I've attached a test program, a text xsl file and a test xml document. Running the program under mono 1.2.5 (/trunk/ r84242) (the program was compiled with Mono C# compiler version 1.2.5.0) with --debug gives me:

Unhandled Exception: System.Xml.Xsl.XsltException: Custom function reported an error. ---> System.InvalidCastException: Cannot cast from source type to destination type.
  at Mono.Xml.Xsl.XsltExtensionFunction.Invoke (Mono.Xml.Xsl.XsltCompiledContext xsltContext, System.Object[] args, System.Xml.XPath.XPathNavigator docContext) [0x00000] --- End of inner exception stack trace ---

  at Mono.Xml.Xsl.XsltExtensionFunction.Invoke (Mono.Xml.Xsl.XsltCompiledContext xsltContext, System.Object[] args, System.Xml.XPath.XPathNavigator docContext) [0x00000]
  at Mono.Xml.Xsl.XPFuncImpl.Invoke (System.Xml.Xsl.XsltContext xsltContext, System.Object[] args, System.Xml.XPath.XPathNavigator docContext) [0x00000]
  at System.Xml.XPath.ExprFunctionCall.Evaluate (System.Xml.XPath.BaseIterator iter) [0x00000]
  at System.Xml.XPath.Expression.EvaluateString (System.Xml.XPath.BaseIterator iter) [0x00000]
  at System.Xml.XPath.CompiledExpression.EvaluateString (System.Xml.XPath.BaseIterator iter) [0x00000]
  at System.Xml.XPath.XPathNavigator.EvaluateString (System.Xml.XPath.XPathExpression expr, System.Xml.XPath.XPathNodeIterator context, IXmlNamespaceResolver ctx) [0x00000]
  at Mono.Xml.Xsl.XslTransformProcessor.EvaluateString (System.Xml.XPath.XPathExpression expr) [0x00000]
  at Mono.Xml.Xsl.Operations.XslValueOf.Evaluate (Mono.Xml.Xsl.XslTransformProcessor p) [0x00000]
  at Mono.Xml.Xsl.Operations.XslTemplateContent.Evaluate (Mono.Xml.Xsl.XslTransformProcessor p) [0x00000]
  at Mono.Xml.Xsl.XslTemplate.EvaluateCore (Mono.Xml.Xsl.XslTransformProcessor p, System.Collections.Hashtable withParams) [0x00000]
  at Mono.Xml.Xsl.XslTemplate.Evaluate (Mono.Xml.Xsl.XslTransformProcessor p, System.Collections.Hashtable withParams) [0x00000]
  at Mono.Xml.Xsl.XslTransformProcessor.ApplyTemplates (System.Xml.XPath.XPathNodeIterator nodes, System.Xml.XmlQualifiedName mode, System.Collections.ArrayList withParams) [0x00000]
  at Mono.Xml.Xsl.XslTransformProcessor.Process (System.Xml.XPath.XPathNavigator root, Mono.Xml.Xsl.Outputter outputtter, System.Xml.Xsl.XsltArgumentList args, System.Xml.XmlResolver resolver) [0x00000]
  at System.Xml.Xsl.XslTransform.Transform (System.Xml.XPath.XPathNavigator input, System.Xml.Xsl.XsltArgumentList args, System.Xml.XmlWriter output, System.Xml.XmlResolver resolver) [0x00000]
  at System.Xml.Xsl.XslTransform.Transform (IXPathNavigable input, System.Xml.Xsl.XsltArgumentList args, System.Xml.XmlWriter output, System.Xml.XmlResolver resolver) [0x00000]
  at XmlTransformExtObj.Transform (System.String stylesheetfilename, System.String inxml) [0x00000]
  at XmlTransformExtObj.Main (System.String[] args) [0x00000]

running the program under Microsoft Windows .Net Framework v2.0.50727 (the program was compiled with Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42) gives me:

210297.Net for monkeys must be returned now!
  .Net for goldfish must be returned now!

...as was expected.

The complete --trace=all output is not attached, as is amounts to 44 Mb. But it can, off course, be made available at request.

Also, I could not help to notice the following - commented - line of code where the exception is thrown in XslFunctions.cs:
//				Debug.WriteLine ("****** INCORRECT RESOLUTION **********");

If more information is needed, please do not hesitate to write me.

Best regards,
Steen Manniche,
Programmer,
Danish Bibliographic Centre,
Tempovej 7-11,
DK-2750 Ballerup

Phone: +45 44 86 78 75
-------------- next part --------------
A non-text attachment was scrubbed...
Name: XmlTransformExtObj.cs
Type: application/octet-stream
Size: 3141 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070818/b4363521/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: recall_extension_object.xsl
Type: application/xml
Size: 406 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070818/b4363521/attachment.rdf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: recall_extension_object.xml
Type: application/xml
Size: 288 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070818/b4363521/attachment-0001.rdf 


More information about the Mono-devel-list mailing list