http://bugzilla.novell.com/show_bug.cgi?id=560064
http://bugzilla.novell.com/show_bug.cgi?id=560064#c0 Summary: Variable containing result-tree-fragment should be true() Classification: Mono Product: Mono: Class Libraries Version: SVN Platform: x86-64 OS/Version: openSUSE 11.2 Status: NEW Severity: Normal Priority: P5 - None Component: Sys.XML AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- This is an incompatibility with .NET. If an <xsl:variable/> is initialized to contain the result of an <xsl:call-template/> (which returns nothing), Mono treats the value as having a false() value within boolean expressions, while .NET treats it as having a true() value. Consider: using System; using System.IO; using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; class Test { public static void Main () { string xsl = @"<xsl:stylesheet version='1.0' exclude-result-prefixes='msxsl' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl='urn:schemas-microsoft-com:xslt' > <xsl:param name='Index' /> <xsl:template match='/'> <root> <xsl:variable name='b'> <xsl:call-template name='get-bar'> <xsl:with-param name='type' select=""'Mono.DocTest.Color'"" /> </xsl:call-template> </xsl:variable> <xsl:if test='$b'> <b hasvalue='true' /> </xsl:if> </root> </xsl:template> <xsl:template name='get-bar'> </xsl:template> </xsl:stylesheet>"; var t = new XslCompiledTransform (); t.Load (new XPathDocument (new StringReader (xsl))); t.Transform ( new XPathDocument ( new XmlTextReader ( new StringReader ( "<root><foo attr='A'/><foo attr='B'/><foo attr='C'/></root>"))), null, Console.Out); Console.WriteLine(); } } The output under Mono: <?xml version="1.0" encoding="utf-8"?><root></root> The output under .NET: <?xml version="1.0" encoding="IBM437"?><root><b hasvalue="true" /></root> Notice that .NET treats <xsl:if test="$b" /> as being true(), not false(), even though $b doesn't actually contain anything. To make .NET behave like Mono, the result tree fragment needs to be converted into a string, e.g.: <xsl:if test="string($b)" /> -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
