Cameron McCormack
Usenet Archive
- Joined
- Jan 10, 2002
- Messages
- 38
- Reaction score
- 0
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
utput 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
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
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