Re: Parentless attribute nodes and namespaces, text says it is disallowed, processors appear to allow it

On 27 September 2015 at 19:18, Florent Georges wrote:

Hi,

>          <xsl:variable name="attr" as="attribute()" xmlns:t="urn:other">
>             <xsl:attribute name="t:test"/>
>          </xsl:variable>

I can't believe that I copied your example, and failed to spot that it
still does not test the point.  It still uses the prefix in the NAME
of the attribute, not its CONTENT.  So it is expected that the
corresponding binding is in scope.

A correct example is the following, and it gives the expected result
(that is, the prefix is not bound, because nothing in the result
sequence contains namespace nodes...)

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
   <xsl:template name="main">
      <result>
         <xsl:variable name="attr" as="attribute()" xmlns:t="urn:other">
            <xsl:attribute name="test" select="'t:test'"/>
         </xsl:variable>
         <xsl:sequence select="$attr"/>
      </result>
   </xsl:template>
</xsl:stylesheet>

Regards,

-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/

Received on Tuesday, 29 September 2015 13:20:26 UTC