You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by David Robinson <dr...@ast.cam.ac.uk> on 1995/12/01 18:41:00 UTC

Re: enhancement (fwd)

Dean wrote:
>It was me working on it, but I wasn't sure that you folks liked the
>way I did it.  I went with:
>
><if expr>
><elsif expr>
><else>
><endif>
>
>example:
>
><if supports=tables>
>    do something with a table
><else>
>    do something with <pre> </pre>
><endif>
>
>expr can have and, or, not, (, and ).
>
>The properties for 'supports=' are defined in the configuration file
>something like this:
>
>UserAgent /^Lynx/ no_images
>UserAgent #Mozilla/[1-9]# tables
>
>I'll respond to him anyhow and Bcc here.

Unfortunately, by using elements like this, you are invading HTML's element
name space. If only HTML had defined elements beginning x- to be for the
user's use...

Anyway, an SGML solution to this problem exists; multiple document
descriptions. You can have a document parsable using two separate
element descriptions, say HTML which describes the formatting, and
SPML which describes the server-parsed interpretation. These represent
two 'views' of the document, and need not correspond at all.

You then preceed the element name with the document type in parentheses.
e.g.

  <(spml)if accept="foo">
  <(html)h1>A foo
  <(spml)else>
  <(html)h1>An html
  </(spml)if>
  title</(html)h1>

i,e. the spml and html elements do not have to nest together.

If an element exists in both DTDs, then you can omit the type name.
So, if you notionally say that SPML contains all of HTML (of course, the
server doesn't have to parse the HTML tags), then you could have

  <(spml)if accept="foo"><h1>A foo title</h1>
  <(spml)else><h1>An html title</h1>
  </(spml)if>

This is actually more compact that <!--#if ... -->, and it's totally clear
where the extra tags go.

 David.