<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:n="http://www.oxygenxml.com/nvdl"
                version="2.0"
                exclude-result-prefixes="n">
   <xsl:output indent="yes"/>
   <xsl:template match="/">
      <n:dispatch>
         <xsl:variable name="content">
            <xsl:apply-templates mode="mode_d1e1"/>
         </xsl:variable>
         <xsl:apply-templates mode="flatten" select="$content"/>
      </n:dispatch>
   </xsl:template>
  <xsl:template match="n:section" mode="mode_d1e1">
      <n:validate schema="helloworld.xsd">
         <xsl:apply-templates mode="mode_d1e1"/>
      </n:validate>
   </xsl:template>
   <xsl:template match="*[namespace-uri()!='http://www.oxygenxml.com/nvdl']" mode="#all"
                 priority="-100">
      <xsl:copy>
         <xsl:apply-templates select="@*[namespace-uri()!='http://www.oxygenxml.com/nvdl']" mode="#current"/>
         <xsl:apply-templates select="@n:*" mode="#current"/>
         <xsl:apply-templates mode="#current"/>
      </xsl:copy>
   </xsl:template>
   <xsl:template match="@*[namespace-uri()!='http://www.oxygenxml.com/nvdl']" mode="#all"
                 priority="-100">
      <xsl:copy/>
   </xsl:template>
   <xsl:template match="@n:*" mode="#all" priority="-100"/>
   <xsl:template match="*" mode="flatten">
      <xsl:apply-templates select="//n:*" mode="flatten1"/>
   </xsl:template>
   <xsl:template match="n:*" mode="flatten1">
      <xsl:copy>
         <xsl:copy-of select="@*"/>
         <xsl:apply-templates select="text()|*[namespace-uri()!='http://www.oxygenxml.com/nvdl']"
                              mode="flatten2"/>
      </xsl:copy>
   </xsl:template>
   <xsl:template match="*[namespace-uri()!='http://www.oxygenxml.com/nvdl']" mode="flatten2">
      <xsl:copy>
         <xsl:copy-of select="@*[namespace-uri()!='http://www.oxygenxml.com/nvdl']"/>
         <xsl:apply-templates select="text()|*[namespace-uri()!='http://www.oxygenxml.com/nvdl']"
                              mode="flatten2"/>
      </xsl:copy>
   </xsl:template>
</xsl:stylesheet>