Esoteric XHTML question about href

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I don't know much about XHTML. I am trying to design an XML standard
where content authors can use HTML or XHTML for the content within an
element. I already know how to use the import element in XML. My question
is even more esoteric than that.

Within the above mentioned XHTML content I want authors to be able to
insert an href to refer to a graphic without knowing what file type that
graphic will be. I want them to be able to point instead to a separate
list of alternative files and the first file in the list will be
displayed if possible. If the browser can't display that first file then
it will try the next until it finds one it can display.

What I want is similar to alternate text except for two things: 1) The
alternative could be a different graphic or even a snipit of MATHML or
INKML. 2)The alternatives aren't listed in the original content. They are
listed in a separate file that can be modified without changing the
original content at all.

Can this be done in XHTML at all?

Can it be done with no server-side code?

If so, what is it called and how do I learn about it?

Thanks in advance.

P.S. This is for a standard for marking up educational material. So any
help you give will benefit all of mankind.

Re: Esoteric XHTML question about href

Grant Robertson wrote:

Quoted text here. Click to load it

That isn't possible - unless the HTML is going to be entered in CDATA
sections or encoding with character references.

Quoted text here. Click to load it

href=" "

... and then the server can deliver up whatever you like.

Quoted text here. Click to load it

<object data="foo.gif" type="image/gif">
  <object data="foo.jpeg" type="image/jpeg">
    <object data="foo.png" type="image/png">
      <object data="foo.svg" type="image/svg+xml">
        <p>Alternative content.</p>

... has been fine since HTML 4.0 ... shame about the browser support though.

Quoted text here. Click to load it

Not with pure HTML.

Quoted text here. Click to load it

Possibly with some JavaScript voodoo, but I wouldn't like to go down that

David Dorward       < <
                     Home is where the ~/.bashrc is

Re: Esoteric XHTML question about href

David Dorward wrote:
Quoted text here. Click to load it

You could use something along these lines:

    <object data="foo">
      <p>Alternative content</p>

Then allow the HTTP server and the browser to automatically negotiate the
best choice of content from foo.gif, foo.jpeg, foo.png and foo.svg using
standard HTTP content negotiation (which is well supported by Apache).

How well that all works in practise on today's user agents is another
matter entirely.

Toby A Inkster BSc (Hons) ARCS
Contact Me ~
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

Re: Esoteric XHTML question about href

Toby A Inkster wrote:

Quoted text here. Click to load it

You mean as I suggested when I said:
href=" "

... and then the server can deliver up whatever you like.
? ;)

Quoted text here. Click to load it

The user agent doesn't matter if you're making the decision based on what
images are available on the server. Apache MultiViews to the rescue!

David Dorward       < <
                     Home is where the ~/.bashrc is

Re: Esoteric XHTML question about href

Toby A Inkster wrote:

Quoted text here. Click to load it

Doesn't Internet Explorer still have serious issues with object elements
(hence my comment about browser support)?

Time to test ...

IE7 says ... "This website wants to run the following add-on: 'Microsoft (R)
HTML Viewer' from 'Microsoft Corporation'. If you trust the website and the
add-on and want to allow it to run, click here..."

Clicking there gives me a menu and lets me pick "Run ActiveX control",
selecting that ...

... and I get a dialog box. "Do you want to run this ActiveX control?"

I say "Run" and ...

The alternative text vanishes to be replaced by nothing at all.

If I try it with explicit height and width specified then ... it draws a box
of the right dimensions, slaps an inset border on the edge, then scales the
image down to fit in the space left, and gives the image a black

hmm, and if I refresh I see a brief flash of the Quicktime logo.

Hang on. Quicktime? That isn't "Microsoft (R) HTML Viewer"

Oh boy. Internet Explorer truly is a world class piece of software.

The good news is that the lack of a type attribute doesn't seem to make any
difference for IE.

David Dorward       < <
                     Home is where the ~/.bashrc is

Re: Esoteric XHTML question about href

I should give some more details about my system. I am working on a
standard for marking up educational material, as I mentioned in my
original post. This material will be designed to be distributed or
downloaded to an individual student's hard drive. It will then be "served
up" and displayed by software on the user's computer. I want the desktop
software to be able to use unmodified browser code to display the
content. This is why it will be XML files with XHTML for the content to
be displayed. The software will look through the XML file for the
particular XHTML content it wants to display. Granted, I could use any
darn file format I want. However, I want to encourage lots of people to
contribute content so I want it to be in standard XHTML so people don't
have to learn anything new.

This content will be very, very modularized and I want to be able to
replace an image in the content with another image or even a snipit of
MathML or a flash applet or whatever without ever having to modify the
original content that refers to it. This way people can submit content
with lame scanned sketches for pictures and others who are more
graphically inclined can submit improved versions of these pictures. Or
someone with no software for entering equations as MathML can submit a
scan of an equation and someone else can enter that as MathML so it will
look better.

Therefore, I can't rely on ANY features of any web server software.
Though it would be OK to require the desktop software to emulate those
features if necessary. All I am concerned with at this time is: Is there
a way to indicate a generically named resource within XHTML code and have
that code still be legal. If someone were using any standard, modern web
design software to design this small hunk of XHTML content would it let
them do it at all? Would it fail to display anything, or would it give an

I know these are very nonstandard questions but this is a very
nonstandard situation where I am trying to use as many existing standards
as possible. I also know I could probably answer these questions myself
if I had time to teach myself web design but I am a little pressed for
time these days with school and this standard that I am trying to work

I do appreciate any help you all can give.

Quoted text here. Click to load it

I know that XHTML can be used as content within an XML file. I have no
problem requiring that HTML be enclosed within CDATA tags. XML and HTML
developers are used to this already.

Quoted text here. Click to load it

Would "someimage" be a folder name? Or is it legal within XHTML to refer
to a resource without specifying a full, specific file name.

Quoted text here. Click to load it

Where would I put this snipit of code? Would this go in the separate file
I was referring to? What would the whole file look like? How, then, would
I refer to this file within the original XHTML content? What is this
technique called so I can look it up on my own?

It doesn't matter about the browser support. I can require that the
desktop software perform a transformation of sorts to dynamically modify
the href attribute just before it sends it to the browser part of their
program. The dynamically modified XHTML content would then merely refer
to a specific file and the browser part would be none the wiser. I just
want to make sure that the XHTML code, as it sits in the original
content, is legal.

If I had to, I guess I could make up my own standard for the way the
separate list is formatted since the only software reading it is the same
software that is reading my XML file. However, I want to use as many
existing standard methods as possible so developers will be able to use
as much existing code as possible. By making it easy to design software
to my standard, I hope to encourage lots of competition in creating
software that works with the standard.

Again, I really appreciate any help anyone can give me.

Site Timeline