Re: [xsl] namespaces declarations treated as boilerplate code

Subject: Re: [xsl] namespaces declarations treated as boilerplate code
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Fri, 15 Aug 2008 10:15:36 -0400
On Fri, 2008-08-15 at 16:58 +0300, George Cristian Bina wrote:
> Hi Robert,
> 
> No, we do not provide that kind of functionality in oXygen.
> Looking into that it turns to be impossible to implement that correctly, 
> as the namespace declaration can be used at runtime, see below an example:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
> version="2.0"
>      xmlns:test="http://www.oxygenxml.com/example";>
>      <xsl:param name="t" select="concat('te', 'st')"/>
>      <xsl:template match="/">
>          <result>
>              <xsl:element name="{$t}:x"></xsl:element>
>          </result>
>      </xsl:template>
> </xsl:stylesheet>
> 
> If the xmlns:test namespace declaration is removed then you will get a 
> runtime error if you run the stylesheet without specifying the t 
> parameter, but if you specify t with the value 'xsl' then there is no 
> error if the namespace declaration is removed.

hmmm... To me, this extremely unlikely use case should not be the
determining factor for such a useful feature. If someone is doing
something like this they should get an error :). As you know, relying on
a prefix is always bad. They could just as easily use the
xsl:element/@namespace (so the IDE would know). Someone with your use
case should simply not use the organize feature.

But it does not seem anyone else is interested in the feature, so...

thanks for trying,
-Rob


> 
> Best Regards,
> George

Current Thread