Re: [xsl] how to define a namespace-prefix for null-namespace

Subject: Re: [xsl] how to define a namespace-prefix for null-namespace
From: Siegfried Baiz <baiz@xxxxxxxxx>
Date: Wed, 23 Mar 2005 19:11:56 +0100
Hallo David,

tanks for your information about the XML-background.

Your last sentence also means that in the XSLT-Spec,
exists no "dummy"-namespace as placeholder for that "no-namespace"
like in my second trial:
<xsl:stylesheet version="2.0" ....  xmlns:my="#default">
  <xsl:template match="my:*">
... ?

Is there any other way to avoid changing all the xpath-selection rsp. all the match-patterns of my stylesheet, when the input-document will be decorated by a namespace.

for example from

<xsl:stylesheet version="2.0" ....  >
  <xsl:template match="root">
       <xsl:apply-template select="tag1/tag2[tag3]"/>

<xsl:stylesheet version="2.0" .... xmlns:my="";>
<xsl:template match="my:root">
<xsl:apply-template select="my:tag1/my:tag2[my:tag3]"/>

As far as I know it is neither possible to use empty namespace-prefix, like
<xsl:stylesheet version="2.0" ....  xmlns="";>
  <xsl:template match="root">
       <xsl:apply-template select="tag1/tag2[tag3]"/>



Dipl.-Math. (Univ.)
Siegfried Baiz
Sulzer GmbH
Frankfurter Ring 162, D-80807 Muenchen
Tel.: +49 89 31858-264
Fax : +49 89 31858-599

David Carlisle wrote:

 In my XSLT-stylesheet I wanted to define a xmlns-prefix for that

The XML Namespaces rec does not allow a prefix to be used with

With XML Namespace 1.0 (which is the version used by almost all systems)
is a syntax error.
With WXML Namespace 1.1 xmlns:my="" is allowed but it does not make
<my:foo/> refer to foo in no-namespace it unbinds the prefix my (if it
had already been bound) so making <my:foo/> an error.

So your requested result isn't conformant to the XML namespaces rec, and
XSLT won't generate it for you.


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread