[Mono-bugs] [Bug 77781][Nor] New - Possible Xpath sort problem

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Mar 13 19:10:12 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by hugobendelin at hotmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=77781

--- shadow/77781	2006-03-13 19:10:12.000000000 -0500
+++ shadow/77781.tmp.5845	2006-03-13 19:10:12.000000000 -0500
@@ -0,0 +1,190 @@
+Bug#: 77781
+Product: Mono: Class Libraries
+Version: 1.1
+OS: Debian Woody
+OS Details: Debian Woody
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: Sys.XML
+AssignedTo: atsushi at ximian.com                            
+ReportedBy: hugobendelin at hotmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Possible Xpath sort problem
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+I Have been trying to write a xsl file to sort and style a xml-document on
+my debian-mono(1.1.13.4)-apache(2.0.54) server. I try to use the xsl:sort
+in a xsl:for-each with a select="count()". Everything works except for the
+sort. Ive tryed the same thing on a computer with the microsoft
+.net-platform and got the correct result.
+
+Steps to reproduce the problem:
+1. xml-file
+<?xml version="1.0" encoding="UTF-8"?>
+<matches team="Norabs">
+	<players>
+		<player nr="2" wikiName="CarlWistedt" shortName="carl">Carl Wistedt</player >
+		<player nr="8" wikiName="PeterLindblad" shortName="pete">Peter
+Lindblad</player >
+		<player nr="7" wikiName="JimmyHolmqvist" shortName="jim">Jimmy
+Holmqvist</player >
+		<player nr="5" wikiName="HenrikNorabs" shortName="henk">Henrik
+Norabs</player >
+		<player nr="48" wikiName="NorabsFallman" shortName="fallm">Norabs
+Fallman</player >
+		<player nr="3" wikiName="LasseNorabs"  shortName="lars">Lasse
+Norabs</player >
+		<player nr="1" wikiName="LelleNorabs"  shortName="lelle">Lelle
+Norabs</player >
+	</players>
+	<match vs="IK" made="11" against="8">
+		<lineup>
+			<player nr="2" />
+			<player nr="7" />
+			<player nr="8" />
+			<player nr="5" />
+			<player nr="3" />
+		</lineup>
+		<score ass="3" goal="2" />
+		<score goal="5" />
+		<score ass="7" goal="2" />
+		<score ass="3" goal="2" />
+		<score goal="2" />
+		<score goal="2" />
+		<score ass="8" goal="2" />
+		<score goal="8" />
+		<score ass="2" goal="8" />
+		<score ass="5" goal="2" />
+		<score ass="3" goal="2" />
+	</match>
+	<match vs="Oops" made="7" against="6">
+		<lineup>
+			<player nr="2" />
+			<player nr="7" />
+			<player nr="8" />
+			<player nr="5" />
+			<player nr="3" />
+		</lineup>
+		<score ass="7" goal="2" />
+		<score ass="2" goal="7" />
+		<score goal="2" />
+		<score goal="3" />
+		<score ass="7" goal="2" />
+		<score ass="2" goal="8" />
+		<score ass="2" goal="5" />
+	</match>
+</matches>
+2. xsl-file, i try sorting players in the xml-file on points, goals and
+assists:
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:template match="/">
+  <xsl:for-each select="matches/players/player">
+   <xsl:sort select="count(/matches/match/score[@goal=current()/@nr]) +
+count(/matches/match/score[@ass=current()/@nr])" data-type="number"
+order="descending" />
+   <xsl:sort select="count(/matches/match/score[@goal=current()/@nr])"
+data-type="number" order="descending" />
+   <xsl:sort select="count(/matches/match/score[@ass=current()/@nr])"
+data-type="number" order="descending" />
+   ...   
+  </xsl:for-each>
+ </xsl:template>
+</xsl:stylesheet>
+
+3.
+The C#-Code:
+public string XmlTransform(string xmlURL, string xslURL)
+{
+	string result= null;
+	XmlDocument xmlDoc = new XmlDocument();
+	XslTransform xslTransform = new XslTransform();
+	
+	try
+	{
+		// Load the XML file
+		xmlDoc.Load(xmlURL);
+	}
+	catch(Exception ex)
+	{
+		result = "Failed to load XML parameter (" + xmlURL + "): " + ex.Message;
+	}
+	if (result==null)
+	{
+		try
+		{
+			// Load the XSL File
+			xslTransform.Load(xslURL);
+		}
+		catch(Exception ex)
+		{
+			result = "Failed to load XSL parameter (" + xslURL + "): " + ex.Message;
+		}
+	}
+	if (result==null)
+	{
+		try
+		{
+			StringWriter sW = new StringWriter();
+			XmlTextWriter XmlW = new XmlTextWriter(sW);
+			xslTransform.Transform(xmlDoc,new XsltArgumentList(),XmlW,null);
+			result = sW.ToString();
+			XmlW.Close();
+		}
+		catch(Exception ex)
+		{
+			result = "Failed to Transform " + ex.Message;
+		}
+	}
+	return result;
+}
+
+4.
+
+Actual Results:
+link - http://bandyboll.mine.nu/default.aspx/AMAWiki/NorabsPlayerStatsVT06.html
+Nr 	Name 	Matcher 	Mål 	(snitt) 	Assist 	(snitt) 	Poäng 	Record 	Fabrikation
+2 	Carl Wistedt(carl) 	10 	30 	(3) 	25 	(2.5) 	55 	7-1-2 
+(8,1)(3,3)(3,1)(3,0)(3,1)(0,2)(2,4)(2,5)(3,5)(3,3)
+8 	Peter Lindblad(pete) 	7 	15 	(2.1) 	4 	(0.5) 	19 	5-1-1 
+(2,1)(1,0)(X,X)(0,0)(3,1)(1,1)(3,0)(5,1)(X,X)(X,X)
+7 	Jimmy Holmqvist(jim) 	8 	13 	(1.6) 	8 	(1) 	21 	7-0-1 
+(0,1)(1,2)(X,X)(X,X)(2,1)(2,0)(0,0)(3,2)(4,1)(1,1)
+5 	Henrik Norabs(henk) 	10 	26 	(2.6) 	5 	(0.5) 	31 	7-1-2 
+(1,1)(1,0)(4,1)(2,0)(1,0)(3,0)(4,0)(1,2)(5,1)(4,0)
+48 	Norabs Fallman(fallm) 	8 	3 	(0.3) 	3 	(0.3) 	6 	5-1-2 
+(X,X)(X,X)(0,1)(0,0)(1,0)(0,0)(0,1)(1,1)(0,0)(1,0)
+3 	Lasse Norabs(lars) 	8 	2 	(0.2) 	6 	(0.7) 	8 	5-1-2 
+(0,3)(1,0)(0,1)(0,0)(0,0)(0,0)(X,X)(X,X)(0,0)(1,2)
+1 	Lelle Norabs(lelle) 	0 	0 	(NaN) 	0 	(NaN) 	0 	0-0-0 
+(X,X)(X,X)(X,X)(X,X)(X,X)(X,X)(X,X)(X,X)(X,X)(X,X)
+
+
+Expected Results:
+link - http://www.flexwiki.com/default.aspx/FlexWiki/CarlWistedt.html
+2 	Carl Wistedt(carl) 	10 	30 	(3) 	25 	(2.5) 	55 	7-1-2 
+(8,1)(3,3)(3,1)(3,0)(3,1)(0,2)(2,4)(2,5)(3,5)(3,3)
+5 	Henrik Norabs(henk) 	10 	26 	(2.6) 	5 	(0.5) 	31 	7-1-2 
+(1,1)(1,0)(4,1)(2,0)(1,0)(3,0)(4,0)(1,2)(5,1)(4,0)
+7 	Jimmy Holmqvist(jim) 	8 	13 	(1.6) 	8 	(1) 	21 	7-0-1 
+(0,1)(1,2)(X,X)(X,X)(2,1)(2,0)(0,0)(3,2)(4,1)(1,1)
+8 	Peter Lindblad(pete) 	7 	15 	(2.1) 	4 	(0.5) 	19 	5-1-1 
+(2,1)(1,0)(X,X)(0,0)(3,1)(1,1)(3,0)(5,1)(X,X)(X,X)
+3 	Lasse Norabs(lars) 	8 	2 	(0.2) 	6 	(0.7) 	8 	5-1-2 
+(0,3)(1,0)(0,1)(0,0)(0,0)(0,0)(X,X)(X,X)(0,0)(1,2)
+48 	Norabs Fallman(fallm) 	8 	3 	(0.3) 	3 	(0.3) 	6 	5-1-2 
+(X,X)(X,X)(0,1)(0,0)(1,0)(0,0)(0,1)(1,1)(0,0)(1,0)
+1 	Lelle Norabs(lelle) 	0 	0 	(NaN) 	0 	(NaN) 	0 	0-0-0 
+(X,X)(X,X)(X,X)(X,X)(X,X)(X,X)(X,X)(X,X)(X,X)(X,X)
+
+How often does this happen? 
+Always
+
+Additional Information:


More information about the mono-bugs mailing list