Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XSLT exclude-result-prefixes not preventing namespace declaration in output

From: Cameron McCormack <heycam@-----.--->
To: NULL
Date: 7/1/2007 6:45:00 PM

Hi everyone.

I'm having trouble working out why exclude-result-prefixes isn't
preventing a namespace declaration in my output document.

This is my input document:

<html xmlns='http://www.w3.org/1999/xhtml' xmlns:x='http://mcc.id.au/
ns/local'>
  <head>
    <title>blah</title>
  </head>
  <body>
    <x:something/>
  </body>
</html>

And this is the XSLT I'm using:

<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
                xmlns:h='http://www.w3.org/1999/xhtml'
                xmlns:x='http://mcc.id.au/ns/local'
                xmlns='http://www.w3.org/1999/xhtml'
                exclude-result-prefixes='h x'
                version='1.0'>

  <xsl:output method='xml' encoding='UTF-8'
              doctype-public='-//W3C//DTD XHTML 1.0 Strict//EN'
              doctype-system='http://www.w3.org/TR/xhtml1/DTD/xhtml1-
strict.dtd'
              media-type='application/xhtml+xml; charset=UTF-8'/>

  <xsl:template match='/'>
    <xsl:apply-templates select='/*'/>
  </xsl:template>

  <xsl:template match='h:*'>
    <xsl:copy>
      <xsl:copy-of select='@*'/>
      <xsl:apply-templates select='node()'/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

When I run xsltproc to transform the input document, I get this
output:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://mcc.id.au/
ns/local">
  <head><meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />
    <title>blah</title>
  </head>
  <body>

  </body>
</html>

Could someone explain why the xmlns:x attribute is still in there, and
how I can prevent it?

Thanks,

Cameron



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent