Solved

XSLT namesapce declarations inserted as attributes in transformation result

Posted on 2007-03-22
1
225 Views
Last Modified: 2013-11-18
XSLT file looks like:

<xsl:stylesheet version="1.0"
                                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                        xmlns:ms="urn:schemas-microsoft-com:xslt"
                        xmlns:vb="urn:the-xml-files:xslt-vb">

<xsl:output method="html" omit-xml-declaration="yes" indent="yes" />

<xsl:template match="test">
<div>
   test
</div>
      
</xsl:template>
</xsl:stylesheet>

XML file:

<?xml version="1.0" encoding="UTF-8"?>
<test>
</test>


xml/xsl loading with MSXML
Dim objXML 'As MSXML2.DOMDocument
            Set objXML = Server.CreateObject( "MSXML2.DOMDocument.4.0" )
            With objXML
                .async = False                        'We do not want asynchronous downloads
                .validateOnParse = true        'don't want to validate against a schema
                .preserveWhiteSpace = True 'preserve white space
                .resolveExternals = False       'do not resolve external DTDs, etc
            End With
XMLDocument.transformNode(XSLDocument)

After transformation  i've got this:

<div xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:vb="urn:the-xml-files:xslt-vb">
   test
</div>

Question: how to omit xmlns:vb and xmlns:ms inserting as attributes.

Thanks
0
Comment
Question by:Bill_Harrison
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
jkmyoung earned 500 total points
ID: 18773329
Use exclude-result-prefixes, eg

<xsl:stylesheet version="1.0"
                                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                        xmlns:ms="urn:schemas-microsoft-com:xslt"
                        xmlns:vb="urn:the-xml-files:xslt-vb"
exclude-result-prefixes="ms vb">
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question