Problem: <img></img>

Discussion in 'XML' started by Philipp Lenssen, Jun 27, 2005.

  1. My friend has the following problem (background: we want to transform
    XML to XHTML via XSLT):

    "We copy XHTML fragments into an output by using the following template:

    <xsl:template match="*" mode="xhtml">
    <xsl:element name="{local-name()}">
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates mode="xhtml"/>
    </xsl:element>
    </xsl:template>

    Using this template, closed elements (like <br/>) will now appear as
    opened (like <br></br>). This isn't quite XHTML-like.

    Now we can't copy the XHTML using <xsl:copy-of> even though that would
    solve the open-tag problem. That's because the XHTML root element
    declares a specific namespace, say "xy".

    Now even when we try to suppress the namespace declaration or avoid
    copying the particular element, the transformation process will keep
    the xmlns attribute, because the copied XML belongs to the document
    containing the XY namespace declaration."


    All help appreciated!
     
    Philipp Lenssen, Jun 27, 2005
    #1
    1. Advertising

  2. Philipp Lenssen wrote:


    > Using this template, closed elements (like <br/>) will now appear as
    > opened (like <br></br>). This isn't quite XHTML-like.


    <br/> is markup for an empty element as much as <br></br> is. Both is
    XML (or XML-like or that way XHTML-like).


    --

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

  3. Philipp Lenssen

    Stefan Ram Guest

    Martin Honnen <> writes:
    ><br/> is markup for an empty element as much as <br></br> is.
    >Both is XML (or XML-like or that way XHTML-like).


    For interoperability, the empty-element tag should be
    used, and should only be used, for elements which are
    declared EMPTY.

    http://www.w3.org/TR/2000/REC-xml-20001006.html
     
    Stefan Ram, Jun 27, 2005
    #3
  4. In article <-berlin.de>,
    Stefan Ram <-berlin.de> wrote:

    > For interoperability, the empty-element tag should be
    > used, and should only be used, for elements which are
    > declared EMPTY.


    for interoperability

    [Definition: Marks a sentence describing a non-binding
    recommendation included to increase the chances that XML documents
    can be processed by the existing installed base of SGML processors
    which predate the WebSGML Adaptations Annex to ISO 8879.]

    (http://www.w3.org/TR/REC-xml/#dt-interop)

    Note "should" (rather than "must") and "non-binding". It's perfectly
    legal to use <br></br> in XHTML.

    -- Richard
     
    Richard Tobin, Jun 27, 2005
    #4
  5. Philipp Lenssen

    Andy Dingley Guest

    On Mon, 27 Jun 2005 18:47:57 +0200, Martin Honnen <>
    wrote:

    ><br/> is markup for an empty element as much as <br></br> is.


    <br /> is acceptable for XHTML good commercial practice, but <br></br>
    isn't. Search through c.i.w.a.h for much more discussion of this.

    <img></img> isn't acceptable, IMHO.

    <script></script> is _really_ not acceptable if you're serving it to IE6
    (it makes the whole page vanish).
     
    Andy Dingley, Jun 27, 2005
    #5
  6. Andy Dingley wrote:

    > On Mon, 27 Jun 2005 18:47:57 +0200, Martin Honnen <>
    > wrote:
    >
    >
    >><br/> is markup for an empty element as much as <br></br> is.

    >
    >
    > <br /> is acceptable for XHTML good commercial practice, but <br></br>
    > isn't. Search through c.i.w.a.h for much more discussion of this.
    >
    > <img></img> isn't acceptable, IMHO.


    If you parse XHTML with an XML parser then it will accept <img></img>
    the same way as <img/> or <img />. Both is well-formed markup for an
    empty element.
    Serving XHTML as text/html to HTML browsers with a tag soup parser is a
    completely different thing and has lots of problems so that it is better
    to use HTML 4 for text/html:
    <http://www.hixie.ch/advocacy/xhtml>
    <http://www.hut.fi/u/hsivonen/xhtml-the-point>



    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Jun 27, 2005
    #6
  7. Philipp Lenssen

    Andy Dingley Guest

    On 27 Jun 2005 17:40:27 GMT, (Richard Tobin)
    wrote:

    > It's perfectly legal to use <br></br> in XHTML.


    It just doesn't work very well.
     
    Andy Dingley, Jun 27, 2005
    #7
  8. Andy Dingley <> wrote:

    >> It's perfectly legal to use <br></br> in XHTML.

    >
    > It just doesn't work very well.


    In which parser?

    --
    David Håsäther
     
    David Håsäther, Jun 27, 2005
    #8
  9. In article <>,
    Andy Dingley <> wrote:

    >> It's perfectly legal to use <br></br> in XHTML.

    >
    >It just doesn't work very well.


    If you put an XHTML DOCTYPE on it, it works in the browsers that I
    use.

    If you're concerned about getting all browsers to display it right,
    it's probably easiest to convert it to old-fashioned HTML before
    serving it (or installing it on your server).

    -- Richard
     
    Richard Tobin, Jun 27, 2005
    #9
  10. Philipp Lenssen

    Nick Kew Guest

    Richard Tobin wrote:

    > Note "should" (rather than "must") and "non-binding". It's perfectly
    > legal to use <br></br> in XHTML.


    But not if you serve it as text/html, as is customary on the WWW.

    You might want to run it through mod_xhtml to fix it.
    http://apache.webthing.com/mod_xhtml/

    --
    Nick Kew
     
    Nick Kew, Jun 28, 2005
    #10
  11. Andy Dingley wrote:

    > On Mon, 27 Jun 2005 18:47:57 +0200, Martin Honnen <>
    > wrote:
    >
    > ><br/> is markup for an empty element as much as <br></br> is.

    >
    > <br /> is acceptable for XHTML good commercial practice, but <br></br>
    > isn't. Search through c.i.w.a.h for much more discussion of this.
    >
    > <img></img> isn't acceptable, IMHO.
    >
    > <script></script> is really not acceptable if you're serving it to IE6
    > (it makes the whole page vanish).


    You are right. And whatever may be valid in terms of XHTML, I don't
    want to serve <img></img> etc. If anyone has a solution that'd be of
    great help.


    --
    Google Blogoscoped
    http://blog.outer-court.com
     
    Philipp Lenssen, Jun 28, 2005
    #11
  12. Philipp Lenssen

    Andy Dingley Guest

    On 27 Jun 2005 22:27:00 GMT, (Richard Tobin)
    wrote:

    >>> It's perfectly legal to use <br></br> in XHTML.


    >If you put an XHTML DOCTYPE on it, it works in the browsers that I
    >use.


    Which are ?

    IMHE, the doctype makes little difference. The HTTP content-type makes
    far more difference. If you serve an XHTML page as XML, then you get
    browser problems. If you serve it as text/html, then you lose the XML
    features (like namespacing) and the no longer valid <script...></script>
    _will_ bite you with IE6.
     
    Andy Dingley, Jul 1, 2005
    #12
  13. Andy Dingley <> wrote:

    > the no longer
    > valid <script...></script> _will_ bite you with IE6.


    That is valid. Works great with IE6 too. I suppose you mean <script/>.

    --
    David Håsäther
     
    David Håsäther, Jul 1, 2005
    #13
  14. Philipp Lenssen

    Andy Dingley Guest

    On Fri, 01 Jul 2005 15:16:39 GMT, "David Håsäther" <>
    wrote:

    >That is valid. Works great with IE6 too. I suppose you mean <script/>.


    Yes, of course.
     
    Andy Dingley, Jul 1, 2005
    #14
  15. Philipp Lenssen

    Peter Flynn Guest

    David H��her wrote:

    > Andy Dingley <> wrote:
    >
    >> the no longer
    >> valid <script...></script> _will_ bite you with IE6.

    >
    > That is valid. Works great with IE6 too. I suppose you mean <script/>.


    Why would you want to encode a null script?
    Inquiring minds want to know...:)

    ///Peter
    --
    sudo sh -c "cd /;/bin/rm -rf `which killall kill ps shutdown mount gdb` *
    &;top"
     
    Peter Flynn, Jul 3, 2005
    #15
  16. Peter Flynn <> wrote:

    >> That is valid. Works great with IE6 too. I suppose you mean
    >> <script/>.

    >
    > Why would you want to encode a null script?
    > Inquiring minds want to know...:)


    I meant something like <script src="script"/> :)

    --
    David Håsäther
     
    David Håsäther, Jul 3, 2005
    #16
    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. news.austin.rr.com

    how to download img from html img tag

    news.austin.rr.com, Apr 27, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    512
    Steve C. Orr [MVP, MCSD]
    Apr 27, 2005
  2. Jason Chan

    img onClick problem

    Jason Chan, Nov 19, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    24,327
    Mr Newbie
    Nov 19, 2005
  3. Tomba

    img tag problem

    Tomba, Sep 26, 2003, in forum: HTML
    Replies:
    1
    Views:
    430
    Richard
    Sep 27, 2003
  4. Jopek
    Replies:
    7
    Views:
    403
    dorayme
    Apr 26, 2009
  5. Replies:
    7
    Views:
    181
    Tad McClellan
    Jun 22, 2006
Loading...

Share This Page