XSLT and faulty HTML output

Discussion in 'XML' started by Taare, Apr 27, 2005.

  1. Taare

    Taare Guest

    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
     
    Taare, Apr 27, 2005
    #1
    1. Advertising

  2. Taare wrote:

    > <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.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Apr 27, 2005
    #2
    1. Advertising

  3. "Taare" <> writes:

    > 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
    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
     
    David Carlisle, Apr 27, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Zyd

    Faulty SRAM

    Zyd, Jul 12, 2004, in forum: VHDL
    Replies:
    0
    Views:
    724
  2. Naveen K Kohli

    td tag generating faulty code

    Naveen K Kohli, May 13, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    465
    David Lloyd
    May 13, 2005
  3. Neil Cerutti

    Faulty encoding settings

    Neil Cerutti, Oct 17, 2006, in forum: Python
    Replies:
    3
    Views:
    383
    Neil Cerutti
    Oct 17, 2006
  4. Anjali M

    Faulty default!

    Anjali M, Jul 5, 2004, in forum: C Programming
    Replies:
    7
    Views:
    771
    Anjali M
    Jul 6, 2004
  5. Peter Ostermann

    Faulty css files or wrong html code?

    Peter Ostermann, Jan 20, 2008, in forum: HTML
    Replies:
    2
    Views:
    377
    Jukka K. Korpela
    Jan 20, 2008
Loading...

Share This Page