[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: remove blank xmlns

Subject: Re: remove blank xmlns
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 2 Aug 2001 17:05:28 +0100
remove xml namespace
Hi Paul,

> I am using asp to append to an existing xml file. I have set
> resolveExternals = False . This seems to work fine as far as leaving
> my xsl and schema references in place. My problem is that when
> resolveExternals = False, a blank namespace call is inserted. How
> can I stop this from showing up? or remove it from asp? Here is an
> example of what is happening:

It looks as though the ASP is appending elements in no namespace
rather than appending them in the x-schema:sortProjects-schema.xml
namespace that the elements in your original source document are in.

The best solution would be to adjust the ASP code so that it adds the
elements in the correct namespace. You need to create all the elements
with something like:

  document.createNode(1, 'project',
                      'x-schema:sortProjects-schema.xml');

If you can't change the ASP code, then you could use a transformation
in a stylesheet that creates equivalent elements in the
'x-schema:sortProjects-schema.xml' namespace whenever it comes across
one in no namespace (and copies anything already in the
'x-schema:sortProjects-schema.xml' namespace directly). This stylesheet
looks something like:

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

<xsl:variable name="ns"
              select="'http:x-schema:sortProjects-schema.xml'" />
                
<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()" />
  </xsl:copy>
</xsl:template>

<xsl:template match="*[not(namespace-uri())]">
  <xsl:element name="{local-name()}" namespace="{$ns}">
    <xsl:apply-templates select="@*|node()" />
  </xsl:element>
</xsl:template>

</xsl:stylesheet>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.