<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0">
<xsl:import-schema schema-location="input.xsd"
namespace="http://www.example.com"
use-when="system-property('xsl:is-schema-aware')='yes'" />
<xsl:import-schema schema-location="output.xsd"
use-when="system-property('xsl:is-schema-aware')='yes'" />
<xsl:template match="/" use-when="system-property('xsl:is-schema-aware')='yes'" priority="2">
<xsl:variable name="input" as="document-node()">
<xsl:document validation="strict">
<xsl:copy-of select="/" />
</xsl:document>
</xsl:variable>
<xsl:result-document validation="strict">
<xsl:apply-templates select="$input/the-root-elem" />
</xsl:result-document>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates select="the-root-elem" />
</xsl:template>
<xsl:template match="the-root-elem">
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>
<xsl:import-schema schema-location="input.xsd"
namespace="http://www.example.com"
use-when="system-property('xsl:is-schema-aware')='yes'" />
<xsl:import-schema schema-location="output.xsd"
use-when="system-property('xsl:is-schema-aware')='yes'" />
<xsl:template match="/" use-when="system-property('xsl:is-schema-aware')='yes'" priority="2">
<xsl:variable name="input" as="document-node()">
<xsl:document validation="strict">
<xsl:copy-of select="/" />
</xsl:document>
</xsl:variable>
<xsl:result-document validation="strict">
<xsl:apply-templates select="$input/the-root-elem" />
</xsl:result-document>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates select="the-root-elem" />
</xsl:template>
<xsl:template match="the-root-elem">
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>