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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=82815 --- shadow/82815 2007-09-12 05:02:12.000000000 -0400 +++ shadow/82815.tmp.16464 2007-09-12 05:02:12.000000000 -0400 @@ -0,0 +1,351 @@ +Bug#: 82815 +Product: Mono: Class Libraries +Version: 1.2 +OS: +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Normal +Component: Sys.XML +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: Duplicate key in XslTransform + +Description of Problem: +We are trying to transform an xml file to an xml office file using an xslt +written by microsoft. It works well with MS.NET 1.1 and also with libxslt +(xsltproc) but it fails on mono + +Steps to reproduce the problem: +1. +Try this program +// project created on 12/09/2007 at 09:52 +using System; +using System.IO; +using System.Data; +using System.Xml; + +using System.Xml.Xsl; + +using System.Xml.XPath; + +namespace TestXSL +{ + class MainClass + { + public static void Main(string[] args) + { + DataSet ds = new DataSet(); + FileStream fs=new FileStream("./output.xml",FileMode.Create); + + ds.ReadXml("../../Users_new.xml"); + ds.EnforceConstraints=false; + + XmlDataDocument xdd = new XmlDataDocument(ds); + + XslTransform xt = new XslTransform(); + + xt.Load("../../Excel.xsl"); + + xt.Transform(xdd, null, fs); + } + } +} +2. With Users_new.xml +<?xml version="1.0" encoding="UTF-8"?> +<stats> +<Utilisateurs type="NeverConnected" date="11/09/2007 10:43:17"> + <line num="1"> + <user_id>5e10f344-1470-4978-b440-7b8fe678cae1</user_id> + <number>000575</number> + <gender>M.</gender> + <name>Bidon</name> + <first_name>Gerard</first_name> + <budget_code>64900</budget_code> + <budget_label>D.R./PAU</budget_label> + <date_creation>16/04/2007 10:09:34</date_creation> + </line> + </Utilisateurs> +</stats> +3. +<?xml version="1.0"?> + + + +<xsl:stylesheet version="1.0" + + xmlns="urn:schemas-microsoft-com:office:spreadsheet" + + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + + xmlns:msxsl="urn:schemas-microsoft-com:xslt" + + xmlns:user="urn:my-scripts" + + xmlns:o="urn:schemas-microsoft-com:office:office" + + xmlns:x="urn:schemas-microsoft-com:office:excel" + + xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" > + + + +<xsl:template match="/"> + + <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" + + xmlns:o="urn:schemas-microsoft-com:office:office" + + xmlns:x="urn:schemas-microsoft-com:office:excel" + + xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" + + xmlns:html="http://www.w3.org/TR/REC-html40"> + + <xsl:apply-templates/> + + + + <Styles> + + <Style ss:ID="Default" ss:Name="Normal"> + + <Alignment ss:Vertical="Bottom"/> + + <Borders/> + + <Font/> + + <Interior/> + + <NumberFormat/> + + <Protection/> + + </Style> + + <Style ss:ID="s21"> + + <Font ss:Bold="1"/> + + <Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/> + + </Style> + + <Style ss:ID="s22"> + + <Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/> + + <Font ss:Bold="1"/> + + <Interior ss:Color="#99CCFF" ss:Pattern="Solid"/> + + </Style> + + </Styles> + + </Workbook> + +</xsl:template> + + + +<xsl:template match="/*/*"> + + <Worksheet> + + <xsl:attribute name="ss:Name"> + + <xsl:value-of select="local-name(/*/*)"/> + + </xsl:attribute> + + <Table x:FullColumns="1" x:FullRows="1"> + + <Row> + + <xsl:for-each select="*[position() = 1]/*"> + + <Cell ss:StyleID="s22"><Data ss:Type="String"> + + <xsl:value-of select="local-name()"/> + + </Data></Cell> + + </xsl:for-each> + + </Row> + + <xsl:apply-templates/> + + </Table> + + </Worksheet> + +</xsl:template> + + + + + +<xsl:template match="/*/*/*"> + + <Row> + + <xsl:apply-templates/> + + </Row> + +</xsl:template> + + + + + +<xsl:template match="/*/*/*/*"> + + <Cell><Data ss:Type="String"> + + <xsl:value-of select="."/> + + </Data></Cell> + +</xsl:template> + + + + + +</xsl:stylesheet> +Actual Results: +Unhandled Exception: System.ArgumentException: key +Parameter name: Duplicate key in add. + at System.Collections.Specialized.ListDictionary.Add (System.Object key, +System.Object value) [0x00029] in +/home/hubert/mono/mcs/class/System/System.Collections.Specialized/ListDictionary.cs:191 + + at Mono.Xml.Xsl.GenericOutputter.CheckState () [0x001b6] in +/home/hubert/mono/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs:203 + at Mono.Xml.Xsl.GenericOutputter.WriteStartElement (System.String prefix, +System.String localName, System.String nsURI) [0x0009f] in +/home/hubert/mono/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs:246 + at Mono.Xml.Xsl.Operations.XslLiteralElement.Evaluate +(Mono.Xml.Xsl.XslTransformProcessor p) [0x0003e] in +/home/hubert/mono/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs:127 + + at Mono.Xml.Xsl.Operations.XslTemplateContent.Evaluate +(Mono.Xml.Xsl.XslTransformProcessor p) [0x00047] in +/home/hubert/mono/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslTemplateContent.cs:199 + + at Mono.Xml.Xsl.Operations.XslLiteralElement.Evaluate +(Mono.Xml.Xsl.XslTransformProcessor p) [0x000f6] in +/home/hubert/mono/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs:141 + + at Mono.Xml.Xsl.Operations.XslTemplateContent.Evaluate +(Mono.Xml.Xsl.XslTransformProcessor p) [0x00047] in +/home/hubert/mono/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslTemplateContent.cs:199 + + at Mono.Xml.Xsl.Operations.XslLiteralElement.Evaluate +(Mono.Xml.Xsl.XslTransformProcessor p) [0x000f6] in +/home/hubert/mono/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs:141 + + at Mono.Xml.Xsl.Operations.XslTemplateContent.Evaluate +(Mono.Xml.Xsl.XslTransformProcessor p) [0x00047] in +/home/hubert/mono/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslTemplateContent.cs:199 + + at Mono.Xml.Xsl.Operations.XslLiteralElement.Evaluate +(Mono.Xml.Xsl.XslTransformProcessor p) [0x000f6] in +/home/hubert/mono/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs:141 + + at Mono.Xml.Xsl.Operations.XslTemplateContent.Evaluate +(Mono.Xml.Xsl.XslTransformProcessor p) [0x00047] in +/home/hubert/mono/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslTemplateContent.cs:199 + + at Mono.Xml.Xsl.XslTemplate.EvaluateCore +(Mono.Xml.Xsl.XslTransformProcessor p, System.Collections.Hashtable +withParams) [0x000e1] in +/home/hubert/mono/mcs/class/System.XML/Mono.Xml.Xsl/XslTemplate.cs:415 + at Mono.Xml.Xsl.XslTemplate.Evaluate (Mono.Xml.Xsl.XslTransformProcessor +p, System.Collections.Hashtable withParams) [0x0004c] in +/home/hubert/mono/mcs/class/System.XML/Mono.Xml.Xsl/XslTemplate.cs:384 + at Mono.Xml.Xsl.XslTransformProcessor.ApplyTemplates +(System.Xml.XPath.XPathNodeIterator nodes, System.Xml.XmlQualifiedName +mode, System.Collections.ArrayList withParams) [0x0002e] in +/home/hubert/mono/mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs:252 + + 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) +[0x00164] in +/home/hubert/mono/mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs:112 + + at System.Xml.Xsl.XslTransform.Transform (System.Xml.XPath.XPathNavigator +input, System.Xml.Xsl.XsltArgumentList args, System.IO.TextWriter output, +System.Xml.XmlResolver resolver) [0x0002f] in +/home/hubert/mono/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs:237 + at System.Xml.Xsl.XslTransform.Transform (System.Xml.XPath.XPathNavigator +input, System.Xml.Xsl.XsltArgumentList args, System.IO.Stream output, +System.Xml.XmlResolver resolver) [0x0001b] in +/home/hubert/mono/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs:216 + at System.Xml.Xsl.XslTransform.Transform (IXPathNavigable input, +System.Xml.Xsl.XsltArgumentList args, System.IO.Stream output) [0x00000] in +/home/hubert/mono/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs:151 + at TestXSL.MainClass.Main (System.String[] args) [0x0003d] in +/home/hubert/Projects/TestXSL/TestXSL/Main.cs:22 + + + +Expected Results: +output.xml : + +<?xml version="1.0"?> +<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" +xmlns:o="urn:schemas-microsoft-com:office:office" +xmlns:x="urn:schemas-microsoft-com:office:excel" +xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" +xmlns:html="http://www.w3.org/TR/REC-html40" +xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:my-scripts"> +<Worksheet ss:Name="Utilisateurs"><Table x:FullColumns="1" +x:FullRows="1"><Row><Cell ss:StyleID="s22"><Data +ss:Type="String">user_id</Data></Cell><Cell ss:StyleID="s22"><Data +ss:Type="String">number</Data></Cell><Cell ss:StyleID="s22"><Data +ss:Type="String">gender</Data></Cell><Cell ss:StyleID="s22"><Data +ss:Type="String">name</Data></Cell><Cell ss:StyleID="s22"><Data +ss:Type="String">first_name</Data></Cell><Cell ss:StyleID="s22"><Data +ss:Type="String">budget_code</Data></Cell><Cell ss:StyleID="s22"><Data +ss:Type="String">budget_label</Data></Cell><Cell ss:StyleID="s22"><Data +ss:Type="String">date_creation</Data></Cell></Row> + <Row> + <Cell><Data +ss:Type="String">5e10f344-1470-4978-b440-7b8fe678cae1</Data></Cell> + <Cell><Data ss:Type="String">000575</Data></Cell> + <Cell><Data ss:Type="String">M.</Data></Cell> + <Cell><Data ss:Type="String">Tripoli</Data></Cell> + <Cell><Data ss:Type="String">Gerard</Data></Cell> + <Cell><Data ss:Type="String">64900</Data></Cell> + <Cell><Data ss:Type="String">D.R./PAU</Data></Cell> + <Cell><Data ss:Type="String">16/04/2007 10:09:34</Data></Cell> + </Row> + </Table></Worksheet> +<Styles><Style ss:ID="Default" ss:Name="Normal"><Alignment +ss:Vertical="Bottom"/><Borders/><Font/><Interior/><NumberFormat/><Protection/></Style><Style +ss:ID="s21"><Font ss:Bold="1"/><Alignment ss:Horizontal="Center" +ss:Vertical="Bottom"/></Style><Style ss:ID="s22"><Alignment +ss:Horizontal="Center" ss:Vertical="Bottom"/><Font ss:Bold="1"/><Interior +ss:Color="#99CCFF" ss:Pattern="Solid"/></Style></Styles></Workbook> + +How often does this happen? +always + +Additional Information: +Please note that it seems that the bug comes from duplicate namespace name +: xmlns="urn:schemas-microsoft-com:office:spreadsheet" +and xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" +anyway the xslt style sheet seems to be well formated... + +Thanks _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
