Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Left xmlns namespace decls in html output

Help
2004-10-11
2012-10-08
  • Peter lammich
    Peter lammich
    2004-10-11

    I've the following problem: Given the following stylesheet:
    <xsl:stylesheet version = "2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:fn="http://www.w3.org/2004/07/xpath-functions"

    xmlns:test="test"

    exclude-result-prefixes="fn xs test"
    >

    <xsl:output method="html"/>

    <xsl:template match="/">
    <html><body><xsl:sequence select="*"/></body></html>
    </xsl:template>
    </xsl:stylesheet>

    and the following input file:
    <h1 xmlns:test="test">
    This is a headline
    </h1>

    I get the following output:
    <html>
    <body>
    <h1 xmlns:test="test">
    This is a headline

      &lt;/h1&gt;
    

    </body>
    </html>

    The problem is the xmlns:test namespace declaration, it should not occur in html output. How can I get rid of
    this declaration. It always occurs when I copy elements from the input (with the namespace in scope) to the (html) output. Is there a way to tell saxon to remove the unused namespace declarations ?

    thanks in advance
    --peter

     
    • Michael Kay
      Michael Kay
      2004-10-11

      Try replacing

      <xsl:sequence select="*"/>

      with

      <xsl:copy-of select="*" copy-namespaces="no"/>

      Michael Kay