You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by TD...@ebmail.gdeb.com on 2000/10/25 17:26:23 UTC

Is it possible to generate namespace prefixes at run-time

Xalan Community,

I am in the process of generating a stylesheet that converts our in-house
XML encoding format to the SOAP XML encoding format.  The stylesheet is
designed to be generic in that it will work on any input XML file, which
may contain namespaces.  My problem is that I need to set the namespace
prefixes of the output XML file based upon the input XML file namespace's
prefixes.

I do not want to hardwire the namespaces in the XSLT file (inside the
<Stylesheet > element) but rather set them at run-time (as I am working on
the input file, determine the namespaces prefixes and then generate them on
the output).  Is this possible in XSLT? If so, then how?

thanks in advance
Thomas Daggett
ATG/GD/EB



Re: Is it possible to generate namespace prefixes at run-time

Posted by Gary L Peskin <ga...@firstech.com>.
TDAGGETT@ebmail.gdeb.com wrote:
> Xalan Community,
> 
> I am in the process of generating a stylesheet that converts our in-house
> XML encoding format to the SOAP XML encoding format.  The stylesheet is
> designed to be generic in that it will work on any input XML file, which
> may contain namespaces.  My problem is that I need to set the namespace
> prefixes of the output XML file based upon the input XML file namespace's
> prefixes.
> 
> I do not want to hardwire the namespaces in the XSLT file (inside the
> <Stylesheet > element) but rather set them at run-time (as I am working on
> the input file, determine the namespaces prefixes and then generate them on
> the output).  Is this possible in XSLT? If so, then how?
> 
> thanks in advance
> Thomas Daggett
> ATG/GD/EB

Thomas --

Can you give an example showing your input and expected output?  You
should be able to create namespaces on output elements using the
namespace attribute of xsl:element.  The XSLT processor is free to pick
the prefixes it desires (I think) as long as they are correctly mapped
to the namespace URI.

Also, for straight XSLT questions like this, you're welcome to ask here
but you're likely to have more people see your question on the
XSL-List.  This can result in quicker, more extensive responses.

Gary