xsl-list
[Top] [All Lists]

Re: Why oh Why?? Namespace generation problem.

2003-02-27 17:54:18

Namespaces are special and all, but this is ridiculus! Why treat them any 
different.

They are not treated differently. Namespaces are not attributes they are
part of the name, allowing AVT's there would be like allowing AVT's
in the local part of a name as in
<{$foo}>
to produce a result element with the name given by the variable.

both local names and namespaces need to be known before the stylesheet
starts (in particular to know whether that xmlns=... is going to resolve
to the XSLT namespace.

The solution to generate an element with its name being determined at
runtime is the same whether it's the local name or the namespace name
component of the elements name, use xsl:element, although in your case


I also bumped into problems with trying to create an xmlns attribute
with 
namespace declarations are explictly not attributes in Xpath, they do
not match @* and you can not create them with xsl:attribute, this is
consistent.

You shouldn't have to generate the default namespace declaration at all
just arrange that your stylesheet generates the child elements of
xsd:annotation in the correct namespace and the system will insert a
namespace declaration at a suitable point (or points)

If you do not know what that namespace is until runtime you will need to
generate all descendent elements of this xsd:annotation using
xsl:element and supply $docURL as the namespace name in each case.

David

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>