Re: [xsl] namespace declaration missing in output

Subject: Re: [xsl] namespace declaration missing in output
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 31 Jan 2001 20:25:25 +0000
Hi Philip,

> We do have a workaround by now, using
>   <xsl:attribute name="objectID" namespace="http://www.fiscus.de";>,
> but that generates lots of ns0, ns1, ns2 namespaces.
> It works, but it is not very nice.

I think that the problem you reported might be a bug with the version
of Xalan you're using - certainly Saxon gives you the result that you
expect.  Given your workaround, you could try to give a prefixed name
for the attribute as well as the namespace:

  <xsl:attribute name="fiscus:objectID" namespace="http://www.fiscus.de";>,

and Xalan *might* use that prefix rather than 'ns0' and so on.

Another workaround is to actually create a new element rather than
copying the element from the result tree, i.e.:

  <xsl:template match="*">
    <xsl:element name="{name()}">
      <xsl:attribute name="fiscus:objectID"">
        <xsl:number level="any" count="*"/>
      </xsl:attribute>            
      <xsl:apply-templates          
select="@*|node()|comment()|processing-instruction()"/>
    </xsl:element>
  </xsl:template>

I *think* that the element that's created will have to have all the
namespaces nodes on it that are on the xsl:element instruction (i.e.
all those in effect for the stylesheet as a whole) aside from those
that are explicitly ignored (i.e. the XML and XSLT namespaces, and any
that are declared as extension element namespaces or namespaces to be
omitted from the result tree).  Worth a go, anyway :)

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