[Mono-bugs] [Bug 68267][Nor] New - xslt variables not resolved when in a xpath predicate expression

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 14 Oct 2004 00:09:08 -0400 (EDT)


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 ehlert@systransoft.com.

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

--- shadow/68267	2004-10-14 00:09:08.000000000 -0400
+++ shadow/68267.tmp.18610	2004-10-14 00:09:08.000000000 -0400
@@ -0,0 +1,144 @@
+Bug#: 68267
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ehlert@systransoft.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: xslt variables not resolved when in a xpath predicate expression
+
+Description of Problem:
+
+When using XslTransform.Transform, when a variable or parameter is used in 
+an xpath predicate expression it is not resolved.
+
+In general,
+
+<xsl:stylesheet ...
+  <xsl:param name="parameter"/> 
+  ...
+  <xsl:template ...
+     <xsl:... select="nodelist[@attribute=$parameter]" ...
+
+Results in an error when resolving $parameter.
+
+
+See attachments to reproduce:
+to compile: mcs Test.cs
+to use: mono Test.exe <xsltfile>
+
+Three test cases provided, all should have the same output:
+test
+this is a test
+
+1. A working xslt for demonstration purposes.
+$ mono Test.exe test1.xslt
+test
+this is a test
+
+
+2. An xslt that uses a global parameter within an xpath predicate 
+expression.
+$ mono Test.exe test2.xslt
+
+Unhandled Exception: System.Xml.XPath.XPathException: variable test not 
+found
+in <0x0011d> System.Xml.XPath.ExprVariable:Evaluate 
+(System.Xml.XPath.BaseIterator)
+in <0x000c5> System.Xml.XPath.EqualityExpr:EvaluateBoolean 
+(System.Xml.XPath.BaseIterator)
+in <0x0015c> System.Xml.XPath.PredicateIterator:MoveNext ()
+in <0x003d2> System.Xml.XPath.SlashIterator:MoveNext ()
+in <0x0014a> System.Xml.XPath.Expression:EvaluateString 
+(System.Xml.XPath.BaseIterator)
+in <0x00012> System.Xml.XPath.CompiledExpression:EvaluateString 
+(System.Xml.XPath.BaseIterator)
+in <0x000d1> System.Xml.XPath.XPathNavigator:EvaluateString 
+(System.Xml.XPath.XPathExpression,System.Xml.XPath.XPathNodeIterator,System
+.Xml.XmlNamespaceManager)
+in <0x0008b> Mono.Xml.Xsl.XslTransformProcessor:EvaluateString 
+(System.Xml.XPath.XPathExpression)
+in <0x00032> Mono.Xml.Xsl.Operations.XslValueOf:Evaluate 
+(Mono.Xml.Xsl.XslTransformProcessor)
+in <0x00089> Mono.Xml.Xsl.Operations.XslTemplateContent:Evaluate 
+(Mono.Xml.Xsl.XslTransformProcessor)
+in <0x001a2> Mono.Xml.Xsl.XslTemplate:Evaluate 
+(Mono.Xml.Xsl.XslTransformProcessor,System.Collections.Hashtable)
+in <0x0008e> Mono.Xml.Xsl.XslTransformProcessor:ApplyTemplates 
+(System.Xml.XPath.XPathNodeIterator,System.Xml.XmlQualifiedName,System.Coll
+ections.ArrayList)
+in <0x005e0> Mono.Xml.Xsl.XslTransformProcessor:Process 
+(System.Xml.XPath.XPathNavigator,Mono.Xml.Xsl.Outputter,System.Xml.Xsl.Xslt
+ArgumentList,System.Xml.XmlResolver)
+in <0x000a6> System.Xml.Xsl.ManagedXslTransform:Transform 
+(System.Xml.XPath.XPathNavigator,System.Xml.Xsl.XsltArgumentList,System.IO.
+TextWriter,System.Xml.XmlResolver)
+in <0x000b3> System.Xml.Xsl.ManagedXslTransform:Transform 
+(System.Xml.XPath.XPathNavigator,System.Xml.Xsl.XsltArgumentList,System.IO.
+Stream,System.Xml.XmlResolver)
+in <0x0001a> System.Xml.Xsl.XslTransform:Transform 
+(System.Xml.XPath.XPathNavigator,System.Xml.Xsl.XsltArgumentList,System.IO.
+Stream,System.Xml.XmlResolver)
+in <0x0003d> System.Xml.Xsl.XslTransform:Transform 
+(System.Xml.XPath.IXPathNavigable,System.Xml.Xsl.XsltArgumentList,System.IO
+.Stream)
+in <0x0014f> xslttest.Test:Main (string[])
+
+
+3. An xslt that uses a local variable within an xpath predicate expression.
+$ mono Test.exe test3.xslt
+
+
+Unhandled Exception: System.NullReferenceException: Object reference not 
+set toan instance of an object
+in <0x0003c> Mono.Xml.Xsl.Operations.XslGeneralVariable:Evaluate 
+(System.Xml.Xsl.XsltContext)
+in <0x0004f> Mono.Xml.Xsl.Operations.XPathVariableBinding:Evaluate 
+(System.Xml.XPath.BaseIterator)
+in <0x000c5> System.Xml.XPath.EqualityExpr:EvaluateBoolean 
+(System.Xml.XPath.BaseIterator)
+in <0x0015c> System.Xml.XPath.PredicateIterator:MoveNext ()
+in <0x003d2> System.Xml.XPath.SlashIterator:MoveNext ()
+in <0x0014a> System.Xml.XPath.Expression:EvaluateString 
+(System.Xml.XPath.BaseIterator)
+in <0x00012> System.Xml.XPath.CompiledExpression:EvaluateString 
+(System.Xml.XPath.BaseIterator)
+in <0x000d1> System.Xml.XPath.XPathNavigator:EvaluateString 
+(System.Xml.XPath.XPathExpression,System.Xml.XPath.XPathNodeIterator,System
+.Xml.XmlNamespaceManager)
+in <0x0008b> Mono.Xml.Xsl.XslTransformProcessor:EvaluateString 
+(System.Xml.XPath.XPathExpression)
+in <0x00032> Mono.Xml.Xsl.Operations.XslValueOf:Evaluate 
+(Mono.Xml.Xsl.XslTransformProcessor)
+in <0x00089> Mono.Xml.Xsl.Operations.XslTemplateContent:Evaluate 
+(Mono.Xml.Xsl.XslTransformProcessor)
+in <0x001a2> Mono.Xml.Xsl.XslTemplate:Evaluate 
+(Mono.Xml.Xsl.XslTransformProcessor,System.Collections.Hashtable)
+in <0x0008e> Mono.Xml.Xsl.XslTransformProcessor:ApplyTemplates 
+(System.Xml.XPath.XPathNodeIterator,System.Xml.XmlQualifiedName,System.Coll
+ections.ArrayList)
+in <0x005e0> Mono.Xml.Xsl.XslTransformProcessor:Process 
+(System.Xml.XPath.XPathNavigator,Mono.Xml.Xsl.Outputter,System.Xml.Xsl.Xslt
+ArgumentList,System.Xml.XmlResolver)
+in <0x000a6> System.Xml.Xsl.ManagedXslTransform:Transform 
+(System.Xml.XPath.XPathNavigator,System.Xml.Xsl.XsltArgumentList,System.IO.
+TextWriter,System.Xml.XmlResolver)
+in <0x000b3> System.Xml.Xsl.ManagedXslTransform:Transform 
+(System.Xml.XPath.XPathNavigator,System.Xml.Xsl.XsltArgumentList,System.IO.
+Stream,System.Xml.XmlResolver)
+in <0x0001a> System.Xml.Xsl.XslTransform:Transform 
+(System.Xml.XPath.XPathNavigator,System.Xml.Xsl.XsltArgumentList,System.IO.
+Stream,System.Xml.XmlResolver)
+in <0x0003d> System.Xml.Xsl.XslTransform:Transform 
+(System.Xml.XPath.IXPathNavigable,System.Xml.Xsl.XsltArgumentList,System.IO
+.Stream)
+in <0x0014f> xslttest.Test:Main (string[])