By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,148 Members | 739 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,148 IT Pros & Developers. It's quick & easy.

XSLT and faulty HTML output

P: n/a
Hi, I got
<xsl:output 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

Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Taare" <ni*************@gmail.com> writes:
Hi, I got
<xsl:output 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
no-namespace will be serialised as <br> not <br/>. If your elements are
in a namespace then the html output method has no real effect.
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.
Thanks in advance
Nikolai Luthman

Jul 20 '05 #2

P: n/a


Taare wrote:
<xsl:output 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:output 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.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.