Microsoft KB Archive/291135

= FIX: XPath Name Function with a Namespace Node Returns Prefix =

Article ID: 291135

Article Last Modified on 8/12/2005

-

APPLIES TO


 * Microsoft XML Core Services 4.0

-



This article was previously published under Q291135



SYMPTOMS
When applied to a namespace node, the XPATH name function returns the prefix (such as xmlns:) as part of the name, at the front of the name.

In contrast, the local-name function does not return the prefix as part of the name of the namespace node.

The name and local-name functions should return the same string when applied to a namespace node.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Microsoft XML 3.0 Service Pack 1.

For additional information on other fixes included in Microsoft XML 3.0 Service Pack 1, click the article number below to view the article in the Microsoft Knowledge Base:

292935 INFO: List of Issues Fixed in Microsoft XML 3.0 Service Pack 1

For the latest information and downloads of MSXML, refer to the following MSDN Web site at:

http://msdn.microsoft.com/xml/default.asp



MORE INFORMATION
The W3C XPath Specification, located at the following Web site

http://www.w3.org/TR/xpath#corelib

states:

&quot;NOTE: The string returned by the name function will be the same as the string returned by the local-name function, except for element nodes and attribute nodes.&quot;

Because the namespace node is neither an element nor an attribute, the name and local-name functions should return the same string.

Steps to Reproduce Behavior
 Create the XML document. The XML document refers to an XSL stylesheet.  Create a new text document by using Microsoft Notepad or another text editor.  Paste the following code into the new text document:     Who's Who in Charlotte <my:author>Stephanie Bourne</my:author> </my:book> </li> Save the text file as C:\XPATHname.XML.</li></ol> </li> Create the XSL stylesheet to process the XML document. <ol style="list-style-type: lower-alpha;"> Create a new text document by using Microsoft Notepad or another text editor.</li>  Paste the following code into the new text document: <?xml version=&quot;1.0&quot;?> <xsl:stylesheet version=&quot;1.0&quot;  xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; xmlns:dt=&quot;urn:uuid:C2F41010-65B3-11d1-A29F-00AA00C14882/&quot; xmlns:my=&quot;urn:http//www.placeholder-name-here.com/schema/&quot;> <xsl:output method=&quot;xml&quot; version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; indent=&quot;yes&quot;/> <xsl:template match = &quot;/&quot;> <xsl:apply-templates select = &quot;bookstore/my:book&quot;/> </xsl:template> <xsl:template match = &quot;my:book&quot;> name: <xsl:value-of select=&quot;name(namespace::*)&quot;/> <BR/> local-name: <xsl:value-of select=&quot;local-name(namespace::*)&quot;/> </xsl:template> </xsl:stylesheet> </li> Save the text file as C:\XPATHname.XSL.</li></ol> </li> Open the XML document in Microsoft Internet Explorer (IE) to process the XML document by using the XSL stylesheet. The following output shows that name and local-name functions return different strings:

name: xmlns:xml

local-name: xml

</li></ol>

Keywords: kbbug kbfix kbmsxml300sp1fix kbmsxmlnosweep KB291135

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.