XSLT and faulty HTML output

T

Taare

Hi, I got
<xsl:eek:utput method="html" encoding="iso-8859-1"
doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="
http://www.w3.org/TR/html4/strict.dtd"/>
in my XSLT file. This should remove all XML related code and replace
with HTML valid code, but with my commandline XSLT
transformer(http://xmlsoft.org/XSLT/) it outputs a xmlns on elements
I'v used <xsl:copy-of select="/some/node"> to produce. Is this how it
should work, or is this a bug/bad implention of XSLT.


Thanks in advance
Nikolai Luthman
 
M

Martin Honnen

Taare said:
<xsl:eek:utput method="html" encoding="iso-8859-1"
doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="
http://www.w3.org/TR/html4/strict.dtd"/>
in my XSLT file. This should remove all XML related code and replace
with HTML valid code, but with my commandline XSLT
transformer(http://xmlsoft.org/XSLT/) it outputs a xmlns on elements
I'v used <xsl:copy-of select="/some/node"> to produce. Is this how it
should work, or is this a bug/bad implention of XSLT.

<xsl:eek:utput method="html" /> is no magic that creates valid HTML 4.01,
you have to make sure you create valid HTML yourself.
"XML related code" is not removed, instead the XSLT 1.0 specification
states about the output method html
<http://www.w3.org/TR/xslt#section-HTML-Output-Method>:

"an element whose expanded-name has a non-null namespace URI should
be output as XML"

thus if you have elements in a namespace and you copy them to the output
they appear in the output and namespace nodes too.

You have to make sure that you do not copy those nodes if you don't want
them in the output.
 
D

David Carlisle

Taare said:
Hi, I got
<xsl:eek:utput method="html" encoding="iso-8859-1"
doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="
http://www.w3.org/TR/html4/strict.dtd"/>
in my XSLT file. This should remove all XML related code and replace
with HTML valid code

That is not what the html output method is defined to do. It makes
no changes to the result tree at all, so if you have element or attribute
or (in this case) namespace nodes that are not valid in HTML then the
resulting file will not be valid HTML.

What the html output does do is output certain elemnts that correspond
to HTML elements using html syntax, so for example an element br in
but with my commandline XSLT
transformer(http://xmlsoft.org/XSLT/) it outputs a xmlns on elements
I'v used <xsl:copy-of select="/some/node"> to produce.

Copy-of may or may not be the right the right thing to do, depending on
what your source looks like.

Is this how it
should work, or is this a bug/bad implention of XSLT.

How it should work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,841
Latest member
WilmerBelg

Latest Threads

Top