Example stylesheet: missing.xsl
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://www.w3.org/1999/XHTML">
<xsl:template match="/">
<xsl:element name="foo">
<bar/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Let's apply it.
$xsltproc missing.xsl missing.xsl
<?xml version="1.0"?>
<foo><bar/></foo>
The output is wrong: the namespace prefix 'xhtml' should be declared on element
bar.
Using the following, equivalent stylesheet instead of the above:
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://www.w3.org/1999/XHTML">
<xsl:template match="/">
<xsl:element name="foo">
<xsl:call-template name="bar"/>
</xsl:element>
</xsl:template>
<xsl:template name="bar">
<bar/>
</xsl:template>
</xsl:stylesheet>
the output is
<?xml version="1.0"?>
<foo><bar xmlns:xhtml="http://www.w3.org/1999/XHTML"/></foo>
which is correct.
Best wishes,
Gábor Braun