I assume you are aware that the xxx prefix is bound to the standard XSLT namespace.

The effect of this is that your stylesheet has an xxx:stylesheet (=xsl:stylesheet) element appearing as a child of xsl:template. This is an error (the children of xsl:template must all be instructions or literal result elements, and xxx:stylesheet is neither). But before Saxon gets around to reporting this error, it makes an incorrect assumption when processing the xsl:apply-templates child of xxx:stylesheet that the containing xxx:stylesheet element is the "real" stylesheet element.

So your stylesheet is in error, but of course Saxon shouldn't fail with an NPE and I will try to find a way of fixing this.

Normally when you use xsl:namespace-alias to generate stylesheets as your output, you should set stylesheet-prefix to the prefix you are using for instructions (here "xsl"), and result-prefix to the prefix used for generated elements, which should be bound to a DIFFERENT namespace.

Michael Kay
Saxonica


On 4 Mar 2014, at 14:16, mozer <xmlizer@gmail.com> wrote:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xxx="http://www.w3.org/1999/XSL/Transform"
  version="2.0">
  <xsl:namespace-alias result-prefix="xsl" stylesheet-prefix="xxx"/>
 
  <xsl:template match="/bar">
    <xsl:variable name="bar" as="element(bar)">
    <bar>
      <xsl:copy-of select="@*"/>
      <xsl:copy-of select="node()"/>
    </bar>
    </xsl:variable>
    <xsl:apply-templates select="$bar"/>
  </xsl:template>
  <xsl:template match="/foo">
    <xxx:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
          <xsl:apply-templates select="*"/>
    </xxx:stylesheet>
  </xsl:template>
</xsl:stylesheet>
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help