This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Problem: namespace declaration in output document


> Now, I have
> the following problem with the namespace declaration:
>
> The wsdl document must look like this:
>
> <definitions name="xyz" targetNamespace="xyz" xmlns:tns="X">
> ...
> </definitions>
>
> where X is the name of the created wsdl document.
>

There are two ways to get a namespace declaration in the result document:
(a) output an element or attribute that relies on this namespace declaration
(b) copy a namespace node from the source document or the stylesheet

If you can put up with dummy attributes in the output, the simplest solution
is to rely on (a):

<xsl:attribute name="dummy" namespace="{-- your namespace here-- }"/>

If not, you have to fall back on (b), which relies on using <xsl:copy> on
namespace nodes, a feature which is defined only in the XSLT 1.0 errata and
may therefore not work with all processors. Also, if the namespace is
generated dynamically form the stylesheet, you need to use the xx:node-set()
extension function:

<xsl:variable name="rtf">
  <xsl:element name="my:dummy" namespace="{-- your namespace here-- }"/>
</xsl:variable>

<definitions>
  <xsl:copy select="xx:node-set($rtf)/*/namespace::my"/>
  <xsl:attribute name="name">xyz</xsl:attribute>

etc.

Mike Kay


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]