Re: [xslt] Suppress namespace in output. Is it possible?



On 2005-01-10 15:57:23 -0800, Jia Pu wrote:
> Ok, let me re-state the question.
> 
> I understand the importance of keeping namespace around. However in
> this particular case, I only want the output *looks* as same as the
> input. In this application, I copy the source tree to output for
> nothing but a reference. So that people who look at the transformed
> output can tell where the output was transformed from.

This is still not clear (see below). :)

But first, is it important not to have the xmlns attribute?

Now, you said: "I only want the output *looks* as same as the input."
Under this condition, you should be aware that the xmlns attribute
isn't the only problem. Indeed, entities in the input file will be
interpreted, and as soon as you have non-ASCII characters, there is
a good chance that you will see something different (as a text file).

Also, if instead of using a default namespace, you used a prefix,
things would also be different.

> Is there anyway to achieve that, other than write my own copy
> template?

If no *source* information has been lost (e.g. due to entities and/or
different character representations), then you can do it. But since
you are interested in the text more than the XML semantic of the
output, then I suggest that you choose text output (I did something
similar to produce RSS files from XHTML files, as the HTML must be
encoded as text, e.g. in a CDATA section). To get the element name
without the namespace part, I suppose you can use the local-name()
function.

-- 
Vincent Lefèvre <vincent vinc17 org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]