Solved

XSLT namesapce declarations inserted as attributes in transformation result

Posted on 2007-03-22
1
223 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
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Word files to Wordpress Posts 2 55
How to use xmlReader and idatareader  ? 4 56
Issue with XSLT mapping 10 36
Eliminate additional border 1 18
Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

803 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