Re: [xsl] Generating JSP/JSTL

Subject: Re: [xsl] Generating JSP/JSTL
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 25 Apr 2007 11:36:21 +0200
Kai Weber wrote:
Hello,

In the archives I found one with a similar problem:
http://www.biglist.com/lists/xsl-list/archives/200102/msg01662.html

Just to recap and to bring my problem to some attention: I want
to create a JSP with some JSTL for later processing on a application
server.



The target document should look like

<ul>
	<c:choose>
		foo
	</c:choose>
</ul>

But this it what it looks:

<ul>
	<c:choose xmlns:c="http://java.sun.com/jsp/jstl/core";>
		foo
	</c:choose>
</ul>

Is it possible to achieve the wanted result and omit the xmlns
declaration in each element?

Kai, as several people already suggested, it is not (easily) possible to make a non-wellformed XML+namespaces document. In early XML days (before the namespaces were added), the colon was allowed as part of the name, making names like "this::was:::a:valid:::name" possible (though unlikely). XSLT however *must* produce namespace well-formed XML, which gives a special meaning on the colon.


But perhaps we didn't understand your question fully. You say "in each element", do you mean that you want the declaration to move up to the root element and disappear on each and every element? That's easily done by removing the "exclude-result-prefixes" attribute of the xsl:stylesheet instruction.

Cheers,
-- Abel Braaksma

Current Thread