You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Tevoi Andrea <te...@cad.it> on 2002/10/11 11:10:37 UTC

namespace dynamic creation

Hi,

in my Xsl i'd like to do something like this:

<xsl:attribute name="xmlns:myprefix"><xsl:value-of select="any XPath expression"/></xsl:attribute>

but for Xsl this is an error (because attribute name begin with "xmlns").

How can i do? I mean: i would create a namespace dynamically using an XPath expression, because I need to create (by xsl transformation) a Schema like this:

<xsd:schema targetNamespace="my dynamic namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:myprefix="my dynamic namespace">...



I've tried a solution creating a dummy attribute:

...
<xsl:attribute name="myprefix:dummy" namespace="{$myDynamicNamespace}"/>
...

This solution works fine with Microsoft Xsl Parser, but doesn't with Xalan (i use version 2.4).

Xalan creates the attribute, but not the namespace declaration.
Please help me.

thanks for your attention,

Andrea Tevoi

Re: namespace dynamic creation

Posted by Joseph Kesselman <ke...@us.ibm.com>.
You could try explicitly putting that attribute into the "namespace for 
namespaces", so it's a proper declaration:

<xsl:attribute name="xmlns:myprefix" namespace="
http://www.w3.org/2000/xmlns/"><xsl:value-of select="any XPath 
expression"/></xsl:attribute>

But I'm not convinced that will work... and I'm not entirely sure the XSLT 
language *has* a way to create namespace declarations at specific places, 
though I'd like to be wrong about that.



______________________________________
Joe Kesselman  / IBM Research