This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: remove blank xmlns
- To: Paul_B_Grimes at dot dot ca dot gov
- Subject: Re: [xsl] remove blank xmlns
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Thu, 2 Aug 2001 17:05:28 +0100
- CC: XSL-List at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <OF3726722D.B2EB130D-ON88256A9B.005CFE72@dot.ca.gov>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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