Groups | Blog | Home
all groups > asp.net building controls > february 2004 >

asp.net building controls : XHTML and custom attributes


Peter Blum
2/26/2004 6:08:11 PM
I'm planning my strategy to be XHTML ready for "Whidbey". My ASP.NET
controls have a lot of client-side scripting. Sometimes I pass along custom
attributes as data for my scripts to use. Those attributes appear in the
normal HTML tag. For example:
<input type=text attr1=value1 attr2=value2 />
(I added them through the control's Attributes collection.)

1. Is it legal to add custom attributes to a known tag in an XHTML page? If
so, does the !DOCTYPE XHTML 1.0 Strict support them?

2. Predefined attributes are supposed to be lowercase names. Are my custom
attributes also supposed to be lowercase?

--- Peter Blum
www.PeterBlum.com
Email: PLBlum@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

Jeffrey Tan[MSFT]
2/27/2004 9:59:09 AM

Hi Peter,

Thank you for posting in the community!

Based on my understanding, you want to know validation about XHtml

==========================================
Actually, you can validate your xhtml through a web of W3 organization,
please refer to:
http://validator.w3.org/

XHtml will use the DTD to validate the attribute for you, so your custom
attribute will be treated as a valid attribute. So your xhtml file will not
be valid.

The html have build-in attributes collection and build-in html tag
collection, you can not extend them.

For more information, I think you should refer to:
http://www.w3.org/TR/xhtml1/#a_dtd_XHTML-1.0-Strict

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Jeffrey Tan[MSFT]
3/2/2004 1:01:26 AM

Hi Peter,

Does my reply make sense to you?

If you still have any concern, please feel free to feedback, I will help
you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Alessandro Zifiglio
3/2/2004 9:15:10 AM
Peter, I think you might want to change that part where you define custom
attributes. As far as XHML 1.0 strict is concerned you have to declare in
all your pages that you are using a specific doc type and all attributes and
elements are already declared in this doc type. When you specify to be using
the XHTML 1.0 strict doc type your browser automatically goes into the so
called "Strict mode". . . .

Attribute :
An attribute is a parameter to an element declared in the DTD. An
attribute's type and value range, including a possible default value, are
defined in the DTD

The above line implies that you cannot use custom attributes. An attribute
has to be declared in the DTD(Document type). "XHTML family document types
are XML based"

4.2 Element and attribute names must be in lower case
XHTML documents must use lower case for all HTML element and attribute
names. This difference is necessary because XML is case-sensitive e.g. <li>
and <LI> are different tags

For more on the differences btw HTML 4 and XHTML take a look at the
following recommendation on the w3c.

http://www.w3.org/TR/2000/REC-xhtml1-20000126/#xhtml


[quoted text, click to view]

Alessandro Zifiglio
3/9/2004 11:46:55 AM
Never saw jeffery's reply. My apologies. Outlook keeps messing up. Think its
time i looked for an update ;P

"Alessandro Zifiglio" <alessandrozifiglio@NO-SPAM-hotmail.com> wrote in
message news:OtX0c.13737$HO2.6258@news.edisontel.com...
[quoted text, click to view]

AddThis Social Bookmark Button