[Mono-bugs] [Bug 391424] New: xsl:document() function does not return a node set
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri May 16 12:52:58 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=391424
Summary: xsl:document() function does not return a node set
Product: Mono: Class Libraries
Version: 1.9.0
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Sys.XML
AssignedTo: atsushi at ximian.com
ReportedBy: vgiszpenc at dsci.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
There may be several issues to get to what I am looking for. I am trying to
apply a transform that contains a call to the document() function.
Test I wrote compiles and works on .Net 2.0. It fails to compile on mono
1.9.1. (Note there is no 1.9.1 version in bugzilla).
--- input.xml ---
<?xml version="1.0" encoding="utf-8"?>
<foo>
<bar id="id1"/>
<bar id="id2"/>
</foo>
--- transform.xslt ---
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:param name="doc" select="document('')"/>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$doc or
count($doc)>0"><xsl:text>Document found</xsl:text></xsl:when>
<xsl:otherwise><xsl:text>Document not
found</xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
---main.cs ---
using System;
using System.Xml;
using System.Xml.Xsl;
namespace XslDocumentTest
{
class MainClass
{
public static void Main(string[] args)
{
XslCompiledTransform xslTransform = new
XslCompiledTransform();
XsltSettings settings = new XsltSettings();
settings.EnableDocumentFunction = true;
xslTransform.Load("transform.xslt", settings, new
XmlUrlResolver());
xslTransform.Transform("input.xml", "output.xml");
}
}
}
--- expected result ouput.xml ---
<?xml version="1.0" encoding="utf-8"?>Document found
--- result of mono XslDocumentTest.exe ---
Unhandled Exception: System.InvalidOperationException: This XmlWriter does not
accept Text at this state Start.
at System.Xml.XmlTextWriter.ShiftStateContent (System.String occured, Boolean
allowAttribute) [0x00000]
at System.Xml.XmlTextWriter.WriteString (System.String text) [0x00000]
at Mono.Xml.Xsl.XmlWriterEmitter.WriteString (System.String text) [0x00000]
at Mono.Xml.Xsl.GenericOutputter.WriteString (System.String text) [0x00000]
at Mono.Xml.Xsl.Operations.XslText.Evaluate
(Mono.Xml.Xsl.XslTransformProcessor p) [0x00000]
at Mono.Xml.Xsl.Operations.XslTemplateContent.Evaluate
(Mono.Xml.Xsl.XslTransformProcessor p) [0x00000]
at Mono.Xml.Xsl.Operations.XslIf.EvaluateIfTrue
(Mono.Xml.Xsl.XslTransformProcessor p) [0x00000]
at Mono.Xml.Xsl.Operations.XslChoose.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.XslCompiledTransform.Transform
(System.Xml.XPath.XPathNavigator input, System.Xml.Xsl.XsltArgumentList args,
System.Xml.XmlWriter output, System.Xml.XmlResolver resolver) [0x00000]
at System.Xml.Xsl.XslCompiledTransform.Transform (System.Xml.XmlReader input,
System.Xml.Xsl.XsltArgumentList args, System.Xml.XmlWriter output,
System.Xml.XmlResolver resolver) [0x00000]
at System.Xml.Xsl.XslCompiledTransform.Transform (System.Xml.XmlReader
reader, System.Xml.Xsl.XsltArgumentList args, System.Xml.XmlWriter output)
[0x00000]
at System.Xml.Xsl.XslCompiledTransform.Transform (System.Xml.XmlReader
reader, System.Xml.XmlWriter output) [0x00000]
at System.Xml.Xsl.XslCompiledTransform.Transform (System.String inputfile,
System.String outputfile) [0x00000]
at XslDocumentTest.MainClass.Main (System.String[] args) [0x00000]
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list