RE: [xsl] Attribute Displayed on Output

Subject: RE: [xsl] Attribute Displayed on Output
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 4 Mar 2005 21:50:46 -0000
> Although it's still not working for Version 2.0, I did
> get it to work in Version 1.0 with one exception:  It
> was displaying the namespace in the output element. 
> For example, my XSL file adds a tag like <a/> to the
> output file under a certain condition.  Unfortunately,
> the output is making it look like:
> 
> <a xmlns:x="yyyyy" xmlns=""/>

First point: do you want the <a> element to be in a namespace or not? If you
want it in a namespace, your stylesheet must put it in a namespace. If you
don't put it in a namespace, the system may have to undeclare the default
namespace in order to ensure that it doesn't go in one. That's what the
xmlns="" is doing.

Second point: if xmlns:x="yyyy" is being copied from the stylesheet, and if
it really isn't used in the output, you can use exclude-result-prefixes to
get rid of it.

> 
> Also, is there a way to automatically assign the
> prefix in the namespace declaration to every element
> in the file, instead of doing it manually for large
> files.  

I'm sorry, I don't understand the question. Which file are we talking about
- source, stylesheet, or result?

Michael Kay
http://www.saxonica.com/

Current Thread