Previous Message
Next Message

[css-d] [OT] - regarding a quick XHTML question

Sent by Aaron Straup Cope on 26 January 2002 10:10


> > In order to keep the address split apart, is the following method
> > acceptable:
> > Can I use XML-style tags here? Just to make the code look more
> > structured? Or will certain browsers run into the tags that aren't
> > in the XHTML Transitional DTD and give the user an error?
>
> You need to stick to whatever DTD you've established. If you're using
XHTML
> Transitional, those new elements will be invalid and will not be
processed.
>

This is true although there is a certain amount of fudging /
whizbang-edness you can accomplish with entity references defined inside
the DOCTYPE declaration itself.

The example below [1] validates using the w3c tool.

Issues :

1) I used the XML nutshell book [2] as a reference. The examples in the
book apply entity reference inside entity declarations [3] which causes
the validator grief. I don't know why.

This could become an issue if you want to start assigning CSS to your new
elements. The example I used assigned the new element to the "misc"
entity, whose widgets are not rendered as "blocks" (?). So, trying to
assign the "foobar" element a border style, to wrap the contents, doesn't
work.

You could redefine the block entity but you would have to explicitly
define all of its entity references, in order to validate. Which is not
the end of the world, just a pain.

<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
<!ENTITY % lists "ul | ol | dl">
<!ENTITY % blocktext "pre | hr | blockquote | address">

<!ENTITY % block
     "p | %heading; | div | %lists; | %blocktext; | fieldset | table">

But if you're just trying to modify XHTML enough to ensure a degree of
abstraction or structure, internally, and still want it to "just work",
this might be a step in that direction.

2) the tailing "]>" in the DOCTYPE declaration gets rendered if the
document is sent to the browser unchaged. I don't know why.

[1]

<?xml version = "1.0" encoding = "UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" [
<!ELEMENT foobar (p*)>
<!ENTITY % misc "ins | del | script | noscript | foobar">
]>

<html>
 <head>
  <title>hello world</title>
 </head>

 <body>
  <foobar>
   <p>
    <strong>abstract</strong>
   </p>
   <p>
    ...
   </p>
  </foobar>
 </body
</html>

[2] XML in a Nutshell, pg 110 (O'Reilly)

[3] <!ENTITY % foobar "(#PCDATA | %misc;)*">
Previous Message
Next Message