[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Adding namespaces to output


Subject: [xsl] Adding namespaces to output
From: hauser felix <felix_hauser@xxxxxxxx>
Date: Mon, 23 Dec 2002 16:09:21 +0100 (CET)

Hello out there

I'm having some xslt-problems, on which I hope you
could give me an advice:

I want to produce the following output using an
xslt-stylesheet:

...
<a xmlns:p="URI"> ... </a>
...

whereas 'URI' is NOT KNOWN IN ADVANCE and has to be
generated using information from in the input
document.

So I tried the following code in my stylesheet:

<xsl:template match="myInputElement">
  <a>
    <xsl:variable name="p">p</xsl:variable>
    <xsl:attribute
name="{concat($p,':dummy-for-xmlns')}"
namespace="{@inputInfo}"/>
  </a>
</xsl:template>

This produces the following output:

<a xmlns:p="URI" p:dummy-for-xmlns=""> ... </a>

This is almost what I want. But I don't like the
'p:dummy-for-xmlns'-Attribute at all. So, here is my
Question: Do you know how to add a prefixed namespace
('xmlns:p="URI"', where URI is not known in advance)
to an output element ('<a>...</a>') WITHOUT producing
an additional dummy-Attribute
('p:dummy-for-xmlns=""')? One Solution would be to
transform the output document again and just remove
the dummy-Attribute, but this doesn't seem to be very
ellegant.

Thank you very much and merry X-mas.

Felix

__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Weihnachts-Einkäufe ohne Stress! http://shopping.yahoo.de

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



Current Thread