Microsoft KB Archive/318890

= INFO: List of Issues Fixed in Microsoft XML 4.0 Service Pack 1 (Part 4 of 4) =

Article ID: 318890

Article Last Modified on 10/16/2002

-

APPLIES TO


 * Microsoft XML Core Services 4.0
 * Microsoft XML Core Services 4.0 Service Pack 1

-



This article was previously published under Q318890



SUMMARY
This article is part 4 of 4 in the series of articles that documents the bugs that are fixed in MSXML 4.0 Service Pack 1 (SP1).

To download MSXML 4.0 SP1, see the following Microsoft Developer Network (MSDN) Web site:

http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/001/766/msdncompositedoc.xml

The following bugs have been fixed in MSXML 4.0 SP1:
 * XSLT: Access Violation When Using Global Variables with Certain Patterns of Object Allocation and Deallocation in XSLT Stylesheet


 * XSLT: Access Violation When Using a Global Variable that Converts a Forward XSLT Variable into a Node-Set


 * XSLT: Access Violation When a Node-Set with 0 or 1 Nodes Is Passed to a Stylesheet and Bound to a Global Variable


 * XSLT: Context Is Lost When Multiple Documents Are Loaded by Using the Document Function


 * XSLT: Incorrect Transformation When You Execute the document('') Function Twice


 * DOM: Access Violation When Passing Null Node-Set to IXSLProcessor::addParameter with selectNodes Method


 * DOM: Run-Time Error with transformNode Method When xsl:apply-templates Is Used to Assign a Value to an xsl:variable Element


 * XPath: Incorrect Results When Executing XPath Queries with position Function Placed to Right of Certain Operators



XSLT: Access Violation When Using Global Variables with Certain Patterns of Object Allocation and Deallocation in XSLT Stylesheet
When you call xmldoc.transformNode(xsldoc) with the following XSL stylesheet 

 

   

    

 <xsl:value-of select=&quot;msxsl:node-set($rtf)&quot; /> </xsl:template>

</xsl:stylesheet>

you may receive the following access violation error message:

The instruction at &quot;0x788b36df&quot; referenced memory at &quot;0xadadadad&quot;. The memory could not be &quot;read&quot;.

back to the top

XSLT: Access Violation When Using a Global Variable that Converts a Forward XSLT Variable into a Node-Set
When you save the following XSL stylesheet as C:\Test2.xsl <xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; xmlns:msxsl=&quot;urn:schemas-microsoft-com:xslt&quot; exclude-result-prefixes=&quot;msxsl&quot;>

<xsl:variable name=&quot;ns&quot; select=&quot;msxsl:node-set($var1)&quot;/>

<xsl:variable name=&quot;var1&quot;> </xsl:variable>

 <xsl:variable name=&quot;ns&quot; select=&quot;$ns&quot;/> </xsl:template>

</xsl:stylesheet>

and you then call xmldoc.transformNode(xsldoc), you may receive the following access violation error message:

The instruction at &quot;0x788cdcca&quot; referenced memory at &quot;0x00000004&quot;. The memory could not be &quot;read&quot;.

back to the top

XSLT: Access Violation When a Node-Set with 0 or 1 Nodes Is Passed to a Stylesheet and Bound to a Global Variable
When you pass a node-set that contains zero nodes or one node, and you then bind the node-set to a global variable, you receive the following access violation error message:

The instruction at &quot;0x788cdcca&quot; referenced memory at &quot;0x00000004&quot;. The memory could not be &quot;read&quot;.

Steps to Reproduce the Behavior <ol> <li>Create a new Microsoft Visual Basic 6.0 Standard EXE project, and then set a project reference to MSXML, v4.0.</li> <li> Save the following XSL stylesheet as C:\Test3.xsl: <?xml version='1.0' ?> <xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;> <xsl:param name=&quot;nodeVar&quot;/>

 <xsl:apply-templates select=&quot;$nodeVar&quot;/> </xsl:template>

 </xsl:template>

</xsl:stylesheet>

</li> <li> Add a Button control to the form. Double-click the Button control, and then paste the following code in Command1_Click: Private Sub Command1_Click Dim xmldoc As New MSXML2.DOMDocument40 xmldoc.async = False xmldoc.loadXML &quot;  &quot;

Dim xsldoc As New MSXML2.FreeThreadedDOMDocument40 xsldoc.async = False xsldoc.Load &quot;C:\test3.xsl&quot;

Dim xslTemplate As New MSXML2.XSLTemplate40 Set xslTemplate.stylesheet = xsldoc Dim xslproc As MSXML2.IXSLProcessor Set xslproc = xslTemplate.createProcessor

xslproc.input = xmldoc Dim nodelist As MSXML2.IXMLDOMNodeList Set nodelist = xmldoc.selectNodes(&quot;test/object&quot;) MsgBox nodelist.length xslproc.addParameter &quot;nodeVar&quot;, nodelist xslproc.Transform

MsgBox xslproc.output End Sub </li> <li>Compile and run the project.</li></ol>

back to the top

XSLT: Context Is Lost When Multiple Documents Are Loaded by Using the Document Function
When you use the XSLT Document function to load multiple documents, context information may be lost.

Steps to Reproduce the Behavior <ol> <li>Create a new Visual Basic 6.0 Standard EXE project, and then set a project reference to MSXML, v4.0.</li> <li> Save the following XSL stylesheet as C:\Test4.xsl: <xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; version=&quot;1.0&quot;> <xsl:output method=&quot;xml&quot; omit-xml-declaration=&quot;yes&quot;/>

<xsl:variable name=&quot;configuration&quot; select=&quot;document('xsltcfg.xml')&quot;/>

 <xsl:apply-templates select=&quot;document('testcat.xml')/test&quot; /> </xsl:template>



<xsl:variable name=&quot;category&quot; select=&quot;@category&quot;/>

<xsl:for-each select=&quot;$configuration&quot;> category : <xsl:value-of select=&quot;$category&quot;/> id($category) : <xsl:value-of select=&quot;id($category)&quot;/> name(id($category)) : <xsl:value-of select=&quot;name(id($category))&quot;/> </xsl:for-each>

</xsl:template>

</xsl:stylesheet>

</li> <li> Paste the following XML in C:\Test4.xml: <submissions configuration-href=&quot;xsltcfg.xml&quot; discretionary-href=&quot;xsltdisc.xml&quot;> <submission href=&quot;testcat.xml&quot; submitter=&quot;test&quot; date=&quot;2001-07-19&quot;/> </li> <li> Save the following XML as C:\Testcat.xml: <test id=&quot;first-test&quot; category=&quot;XSLT-Result-Tree&quot; /> </li> <li> Save the following XML as C:\Xsltcfg.xml: <category id=&quot;XSLT-Template&quot;>matching, call named, priority <category id=&quot;XSLT-Result-Tree&quot;>creation of nodes in result </li> <li> Add a Button control to the form. Double-click the Button control, and then paste the following code in Command1_Click: Private Sub Command1_Click Dim xmldoc As New MSXML2.DOMDocument40 xmldoc.async = False xmldoc.Load &quot;C:\test4.xml&quot;

Dim xsldoc As New MSXML2.DOMDocument40 xsldoc.async = False xsldoc.Load &quot;C:\test4.xsl&quot;

MsgBox xmldoc.transformNode(xsldoc) End Sub </li> <li>Compile and run the project. You receive the following output in a message box:

category : XSLT-Result-Tree

id($category) :

name(id($category)) :

You expect to see the following output:

category : XSLT-Result-Tree

id($category) : creation of nodes in result

name(id($category)) : category

</li></ol>

back to the top

XSLT: Incorrect Transformation When You Execute the document('') Function Twice
If you perform two transformations on an XSLT stylesheet that contains the document('') function, and you reset the stylesheet property on the IXSLTemplate objects with the same stylesheet before you perform the second transformation, the transformation result may be incorrect. When the MSXML parser executes the document('') function, the parser loads the stylesheet based on its Uniform Resource Identifier (URI), then adds the URI of the stylesheet to an internal hash table (that is, the document URI hash table). However, this entry is only added to the hash table when the table is created the first time. When you reset IXSLProcessor for a new transformation, all entries in the document URI table are cleared. When you execute the document('') function again, no URI entry exists for the stylesheet, which results in the incorrect transformation.

The following xsl:template calls document(''), which loads the XSLT stylesheet:  <xsl:copy-of select=&quot;document('')/*/qc:fielddefinitions/object[@name=current/@name]&quot; /> </xsl:template> back to the top

DOM: Access Violation When Passing Null Node-Set to IXSLProcessor::addParameter with selectNodes Method
If selectNodes(&quot;test/test1&quot;) returns a null node-set, and you then run the following code Dim xOutput As MSXML2.FreeThreadedDOMDocument40 Dim xInput As MSXML2.FreeThreadedDOMDocument40 Set xInput = New MSXML2.FreeThreadedDOMDocument40 xInput.async = False xInput.Load App.Path & &quot;\input.xml&quot; Set xOutput = New MSXML2.FreeThreadedDOMDocument40 xOutput.async = False With xTemplate.createProcessor .input = xInput .output = xOutput .addParameter &quot;tablespace&quot;, &quot;bob&quot; On Error GoTo errorHandler .addParameter &quot;userLocations&quot;, xInput.selectNodes(&quot;test/test1&quot;) .Transform End With Text1.Text = xOutput.xml you may receive the following access violation error message at the addParameter call:

The instruction at &quot;0x788cdcca&quot; referenced memory at &quot;0x00000004&quot;. The memory could not be &quot;read&quot;.

back to the top

DOM: Run-Time Error with transformNode Method When xsl:apply-templates Is Used to Assign a Value to an xsl:variable Element
When you use the following code in an XSLT stylesheet <xsl:variable name=&quot;TopSeller&quot;><xsl:apply-templates select=&quot;//BookStore[@TopSeller='yes']&quot; /></xsl:variable> you may receive the following run-time error message with the transformNode method:

ERROR : Run-time error '-1073741795(c000001d)'

back to the top

XPath: Incorrect Results When Executing XPath Queries with position Function Placed to Right of Certain Operators
When you parse the following XML data <?xml version=&quot;1.0&quot;?> <ROOT> <M N=&quot;a&quot;/> <M N=&quot;b&quot;/> <M N=&quot;c&quot;/> <M N=&quot;d&quot;/> <M N=&quot;e&quot;/> </ROOT> and you place the position function on the right side of the < ,<=, >, or >= operators, as follows xmldoc.setProperty &quot;SelectionLanguage&quot;, &quot;XPath&quot;

'The following XPath query displays 2 as the output (this is the correct behavior). MsgBox xmldoc.selectNodes(&quot;//M[position > 3]&quot;).length

'The following XPath query displays 3 as the output (this is the correct behavior). MsgBox xmldoc.selectNodes(&quot;//M[3 < position]&quot;).length End Sub the length of the node list that the second selectNodes returns is 3, which is not correct: mldoc.selectNodes(&quot;//M[3 < position]&quot;).length back to the top

<div class="references_section">