Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 262228 - Last Review: October 15, 2002 - Revision: 1.3
FIX: XML Pattern Match Fails When Using ID Attribute
This article was previously published under Q262228
The MSXML 2.0 parser does not parse match patterns against ID attributes properly. The match pattern may not return any matches even when matches exist.
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
This problem has been fixed in the MSXML 2.5 parser.
For more information, please see the following Microsoft Web site:
Steps to Reproduce Behavior
- Paste the following code into a new text document, and save it as idmatch.xml:
<?xml version="1.0" ?>
<?xml:stylesheet type="text/xsl" href="idmatch.xsl" ?>
<XML xmlns="x-schema:idschema.xml">
<WWITEM id="foot1">
item1
</WWITEM>
<WWITEM id="foot2">
item2
</WWITEM>
</XML>
- Paste the following code into a new text document and save the document in the same location as the previous document, as idschema.xml:
<?xml version="1.0" ?>
<Schema xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:datatypes">
<AttributeType name="id" dt:type="id"/>
<ElementType name="ITEM">
<attribute type="id"/>
</ElementType>
</Schema>
- Insert the following code into a new text document and save the document in the same location as the previous two documents, as idmatch.xsl:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="id('foot1')">
FOOT1 FOUND<BR /><xsl:apply-templates/>
</xsl:template>
<xsl:template match="id('foot2')">
FOOT2 FOUND<BR /><xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
- Browse to the idmatch.xml file by using an Internet Explorer Web browser from a computer with version 2.0 of the MSXML parser installed, and note that the output is blank.
-
Browse to the file again from a computer with version 2.5 of the MSXML parser installed, and note that the output contains two rows indicating that each match pattern was correctly identified.
| kbbug kbfix kbmsxml250fix kbmsxmlnosweep KB262228 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate