473,508 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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!

Jul 20 '05 #1
15 3072


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/
Jul 20 '05 #2
Martin Honnen <ma*******@yahoo.de> 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

Jul 20 '05 #3
In article <em******************************@ram.dialup.fu-berlin.de>,
Stefan Ram <ra*@zedat.fu-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
Jul 20 '05 #4
On Mon, 27 Jun 2005 18:47:57 +0200, Martin Honnen <ma*******@yahoo.de>
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).

Jul 20 '05 #5


Andy Dingley wrote:
On Mon, 27 Jun 2005 18:47:57 +0200, Martin Honnen <ma*******@yahoo.de>
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/
Jul 20 '05 #6
On 27 Jun 2005 17:40:27 GMT, ri*****@cogsci.ed.ac.uk (Richard Tobin)
wrote:
It's perfectly legal to use <br></br> in XHTML.


It just doesn't work very well.
Jul 20 '05 #7
Andy Dingley <di*****@codesmiths.com> 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
Jul 20 '05 #8
In article <db********************************@4ax.com>,
Andy Dingley <di*****@codesmiths.com> 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
Jul 20 '05 #9
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
Jul 20 '05 #10
Andy Dingley wrote:
On Mon, 27 Jun 2005 18:47:57 +0200, Martin Honnen <ma*******@yahoo.de>
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
Jul 20 '05 #11
On 27 Jun 2005 22:27:00 GMT, ri*****@cogsci.ed.ac.uk (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.

Jul 20 '05 #12
Andy Dingley <di*****@codesmiths.com> 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
Jul 20 '05 #13
On Fri, 01 Jul 2005 15:16:39 GMT, "David Håsäther" <ha******@msn.com>
wrote:
That is valid. Works great with IE6 too. I suppose you mean <script/>.


Yes, of course.
Jul 20 '05 #14
David H��her wrote:
Andy Dingley <di*****@codesmiths.com> 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"
Jul 20 '05 #15
Peter Flynn <pe*********@m.silmaril.ie> 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
Jul 20 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2831
by: MyndPhlyp | last post by:
I've been busting my head trying to figure this out for quite some time. With IE6 and NS7, no problems. I can simply code the HTML <img height="100%"> and be done with it. But NS4 and NS6 (and...
7
2615
by: Zhang Weiwu | last post by:
Hello. This is problem puzzled me a long time. I wish to organize some block elements and let them flow one after each other like text. Think about a album, I wish the album have 12 thumbnails,...
2
1693
by: ThePsudo | last post by:
# SIMPLE VERSION # Is there a way I can create a new <img> tag onClick? # DETAILED VERSON # I'm making a game that involves drawing a path between two points on a grid. I've got the...
15
122075
by: Gérard Talbot | last post by:
Hello all, I'd like to know and understand the difference between, say, <img src="/ImageFilename.png" width="123" height="456" alt=""> and <img src="/ImageFilename.png" style="width:...
3
5428
by: Henry Johnson | last post by:
Okay - I'm spinning my wheels on this one... can someone help me figure out how to programmatically populate a table cell as follows (from C# code-behind)? I've tried using a Literal control in the...
10
3259
by: News | last post by:
I am trying to be able to manipulate the width and height of an <img> but do not seem to be able. "Yes", I know the JavaScript will "not" manip anything, which is ok. I simply do not know how to...
1
4598
by: Carl | last post by:
Hi all I have a javascript function that drags and drops an element (ie img) into a container (ie bordered div). The function works and returns the element and and container. My next step is to...
4
9057
by: SammyBar | last post by:
Hi all, I wonder is it possible to upload the content of an <imgfield to a server. The content of the <imgwas downloaded from a web site different from the one it should be uploaded. The image...
4
2001
by: Jon Slaughter | last post by:
I have a captcha system going and for some reason when I use <?php $s = ""; for($i = 0; $i < 10; $i++) { $s = $s.rand(0,9); } $_SESSION = $s; $fn = '/Login/Register/Captcha.php'; echo '<img...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7049
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7499
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5055
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.