Michael Schuerig wrote:[color=blue]
> Nick Kew wrote:
>
>[color=green]
>>Michael Schuerig wrote:
>>[color=darkred]
>>>I would like to define additional attributes on some XHTML elements.
>>>The purpose is to use them as parameters for scripts. So far, I have
>>>no good grasp on how to add attributes *cleanly*. Of course, I can
>>>just put them in, like this,
>>>
>>> <input type="text" myns:maxlength="10" />
>>>
>>>However, that's not valid XHTML. If possible, what I'd like to
>>>achieve is this: I want to live in peace with XHTML validators by
>>>telling them that they should just check the XHTML as they know it
>>>and when they encounter an attribute with a specific prefix they
>>>should not complain about it, but instead accepts that it is my
>>>business to look after the attribute.[/color]
>>
>>You can't if you serve up pages like that. Serve them as XML rather
>>(x)html.[/color][/color]
He didn't give any indication about how they were being served, so how
can you assume that he isn't serving them as XML?
[color=blue]
> What exactly do you mean by "can't"?[/color]
I believe he meant that you can't serve it as text/html, you need to use
an XML MIME type like application/xhtml+xml or application/xml.
[color=blue]
> That it is not possible to achieve valid XHTML in this way?[/color]
Well, it is possible, but you have to write your own DOCTYPE or schema
to validate against. However, you should understand that validity is
different from conformance and even though the document may pass
validation, it may not be conformant.
You should look into XHTML Modularisation, which allows you to extend
the langauge with your own modules.
[color=blue]
> My clients are ordinary current web browsers.[/color]
If that includes "current browsers" (read: obsolete) like IE, then you
can't do what you want because IE will not accept XHTML served with the
correct MIME type. If includes other browsers, such as Firefox, Opera
or nearly every other modern browser, then XHTML modularisation may be
suitable for your needs.
[color=blue]
> Ideally they just ignore attributes they don't know about. I'll
> handle them with JavaScript.[/color]
Your extensions (incluing, among other things, any elements or
attributes you add) will appear in the DOM, but browsers will not do
anything useful with them. Scripts and/or stylesheets will be able to
work with them like any other element or attribute.
--
Lachlan Hunt
http://lachy.id.au/ http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox