This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Exclude result prefixes
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Exclude result prefixes
- From: tcn at melvaig dot co dot uk (Trevor Nash)
- Date: Sat, 04 Aug 2001 15:01:18 GMT
- Organization: Melvaig Software Engineering Limited
- References: <sb6ba78a.029@mail.plumcreek.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
David Morris wrote:
>I was trying to clean up some generated xhtml and decided to get rid
>of some extra namespace declarations. I tried to use the
><xsl:exclude-result-prefixes> to get rid of some namespace declarations
>for namespaces that are not part of my output documents. This removed
>the unneccesary namespaces declaration from the element that I used it
>on (the root), but that just made caused the declaration to come back
>on the root's children.
>
>Thanks,
>
>David Morris
>
Two ideas:
When you say you put it on 'the root', do you mean the literal result
element which is to be the root of the output document, or the
xsl:stylesheet element? (If you are using 'literal result element as
stylesheet' these are the same so ignore this bit). Its usual to put
exclude-result-prefixes on the xsl:stylesheet - I don't think it
should make a difference, but you might try it.
My second guess is that you are using xsl:copy or xsl:copy-of. The
problem is that these copy all the namespace nodes present. Remember
you get a namespace node on an element for all namespaces declared on
that element *or* any of its ancestors: they do not just appear where
the actual declaration is. There are two ways round this that I know
of:
a) move the namespace declarations in the stylesheet or source
document so they do not appear on the nodes you are copying (not
always possible or practical)
b) use xsl:element instead of xsl:copy (messy but it works) or
xsl:copy-of (even messier).
Or just live with it ;-)
Regards,
Trevor Nash
--
Traditional training & distance learning,
Consultancy by email
Melvaig Software Engineering Limited
voice: +44 (0) 1445 771 271
email: tcn@melvaig.co.uk
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list