Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Developer's Guide

Resource: test.xml and test.xsl

This project uses to resource files, an XML data file and an XSLT style sheet. For the XML file, use test.xml from the LoadXMLFile project. The XSLT style sheet, test.xsl, is listing in this topic. This style sheet renames specified elements and leaves others unchanged.

XML Data File (test.xml)

<?xml version="1.0"?>
<root>
   <node>one</node>
   <nodes>
      <node>1</node>
      <node>2</node>
   </nodes>
   <node>two</node>
</root>

XSLT Style Sheet (test.xsl)

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
           version="1.0">

  <!-- Map "root" element to "network" element. -->
  <xsl:template match="root">
    <xsl:element name="network">
       <xsl:apply-templates/>
    </xsl:element>   
  </xsl:template>

  <!-- Keep any other elements as-is. -->
  <xsl:template match="/ | @* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>

To add test.xml and test.xsl to the XSLT Project

  1. Copy test.xml from above, and paste it into a text file. Save the file as test.xml to the same directory where you saved XSLTProj.
  2. Copy the XSLT file above, and paste it into a text file. Save the file as test.xsl to the same directory where you saved XSLTProj and test.xml.

Next, run the project. The result should be the output shown in the following topic.