Problem: <img></img>

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Philipp Lenssen

    Problem: <img></img>

    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!

  • Martin Honnen

    #2
    Re: Problem: &lt;img&gt;& lt;/img&gt;



    Philipp Lenssen wrote:

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

    <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

    Comment

    • Stefan Ram

      #3
      Re: Problem: &lt;img&gt;& lt;/img&gt;

      Martin Honnen <mahotrash@yaho o.de> writes:[color=blue]
      ><br/> is markup for an empty element as much as <br></br> is.
      >Both is XML (or XML-like or that way XHTML-like).[/color]

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



      Comment

      • Richard Tobin

        #4
        Re: Problem: &lt;img&gt;& lt;/img&gt;

        In article <empty-element-tag-20050627193357@ ram.dialup.fu-berlin.de>,
        Stefan Ram <ram@zedat.fu-berlin.de> wrote:
        [color=blue]
        > For interoperabilit y, the empty-element tag should be
        > used, and should only be used, for elements which are
        > declared EMPTY.[/color]

        for interoperabilit y

        [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

        Comment

        • Andy Dingley

          #5
          Re: Problem: &lt;img&gt;& lt;/img&gt;

          On Mon, 27 Jun 2005 18:47:57 +0200, Martin Honnen <mahotrash@yaho o.de>
          wrote:
          [color=blue]
          ><br/> is markup for an empty element as much as <br></br> is.[/color]

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

          Comment

          • Martin Honnen

            #6
            Re: Problem: &lt;img&gt;& lt;/img&gt;



            Andy Dingley wrote:
            [color=blue]
            > On Mon, 27 Jun 2005 18:47:57 +0200, Martin Honnen <mahotrash@yaho o.de>
            > wrote:
            >
            >[color=green]
            >><br/> is markup for an empty element as much as <br></br> is.[/color]
            >
            >
            > <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.[/color]

            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

            Comment

            • Andy Dingley

              #7
              Re: Problem: &lt;img&gt;& lt;/img&gt;

              On 27 Jun 2005 17:40:27 GMT, richard@cogsci. ed.ac.uk (Richard Tobin)
              wrote:
              [color=blue]
              > It's perfectly legal to use <br></br> in XHTML.[/color]

              It just doesn't work very well.

              Comment

              • David Håsäther

                #8
                Re: Problem: &lt;img&gt;& lt;/img&gt;

                Andy Dingley <dingbat@codesm iths.com> wrote:
                [color=blue][color=green]
                >> It's perfectly legal to use <br></br> in XHTML.[/color]
                >
                > It just doesn't work very well.[/color]

                In which parser?

                --
                David Håsäther

                Comment

                • Richard Tobin

                  #9
                  Re: Problem: &lt;img&gt;& lt;/img&gt;

                  In article <dbt0c1p0fnt438 80v63fletaho6e6 jikko@4ax.com>,
                  Andy Dingley <dingbat@codesm iths.com> wrote:
                  [color=blue][color=green]
                  >> It's perfectly legal to use <br></br> in XHTML.[/color]
                  >
                  >It just doesn't work very well.[/color]

                  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

                  Comment

                  • Nick Kew

                    #10
                    Re: Problem: &lt;img&gt;& lt;/img&gt;

                    Richard Tobin wrote:
                    [color=blue]
                    > Note "should" (rather than "must") and "non-binding". It's perfectly
                    > legal to use <br></br> in XHTML.[/color]

                    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.


                    --
                    Nick Kew

                    Comment

                    • Philipp Lenssen

                      #11
                      Re: Problem: &lt;img&gt;& lt;/img&gt;

                      Andy Dingley wrote:
                      [color=blue]
                      > On Mon, 27 Jun 2005 18:47:57 +0200, Martin Honnen <mahotrash@yaho o.de>
                      > wrote:
                      >[color=green]
                      > ><br/> is markup for an empty element as much as <br></br> is.[/color]
                      >
                      > <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).[/color]

                      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
                      A daily news blog and community covering Google, search, and technology.

                      Comment

                      • Andy Dingley

                        #12
                        Re: Problem: &lt;img&gt;& lt;/img&gt;

                        On 27 Jun 2005 22:27:00 GMT, richard@cogsci. ed.ac.uk (Richard Tobin)
                        wrote:
                        [color=blue][color=green][color=darkred]
                        >>> It's perfectly legal to use <br></br> in XHTML.[/color][/color][/color]
                        [color=blue]
                        >If you put an XHTML DOCTYPE on it, it works in the browsers that I
                        >use.[/color]

                        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.

                        Comment

                        • David Håsäther

                          #13
                          Re: Problem: &lt;img&gt;& lt;/img&gt;

                          Andy Dingley <dingbat@codesm iths.com> wrote:
                          [color=blue]
                          > the no longer
                          > valid <script...></script> _will_ bite you with IE6.[/color]

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

                          --
                          David Håsäther

                          Comment

                          • Andy Dingley

                            #14
                            Re: Problem: &lt;img&gt;& lt;/img&gt;

                            On Fri, 01 Jul 2005 15:16:39 GMT, "David Håsäther" <hasather@msn.c om>
                            wrote:
                            [color=blue]
                            >That is valid. Works great with IE6 too. I suppose you mean <script/>.[/color]

                            Yes, of course.

                            Comment

                            • Peter Flynn

                              #15
                              Re: Problem: &lt;img&gt;& lt;/img&gt;

                              David H��her wrote:
                              [color=blue]
                              > Andy Dingley <dingbat@codesm iths.com> wrote:
                              >[color=green]
                              >> the no longer
                              >> valid <script...></script> _will_ bite you with IE6.[/color]
                              >
                              > That is valid. Works great with IE6 too. I suppose you mean <script/>.[/color]

                              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"

                              Comment

                              Working...