[Zope] IMG attributes in ZPT

Troy Farrell troy@entheossoft.com
Mon, 21 Oct 2002 08:21:39 -0500


It's only harmless if you don't validate your XHTML 
(http://validator.w3.org/check/) or you aren't trying to convert a site 
to XHTML.

HTML 4.01 says the border attribute is deprecated.
http://www.w3.org/TR/html401/struct/objects.html#adef-border-IMG

XHTML 1.0 Transitional DTD allows it as well:

<!ELEMENT img EMPTY>
<!ATTLIST img
   %attrs;
   src         %URI;          #REQUIRED
   alt         %Text;         #REQUIRED
   name        NMTOKEN        #IMPLIED
   longdesc    %URI;          #IMPLIED
   height      %Length;       #IMPLIED
   width       %Length;       #IMPLIED
   usemap      %URI;          #IMPLIED
   ismap       (ismap)        #IMPLIED
   align       %ImgAlign;     #IMPLIED
   border      %Length;       #IMPLIED
   hspace      %Pixels;       #IMPLIED
   vspace      %Pixels;       #IMPLIED
   >

but the XHTML 1.0 Strict DTD doesn't allow the border attribute:

<!ELEMENT img EMPTY>
<!ATTLIST img
   %attrs;
   src         %URI;          #REQUIRED
   alt         %Text;         #REQUIRED
   longdesc    %URI;          #IMPLIED
   height      %Length;       #IMPLIED
   width       %Length;       #IMPLIED
   usemap      %URI;          #IMPLIED
   ismap       (ismap)        #IMPLIED
   >


Troy

Felix Ulrich-Oltean wrote:
> On Fri, Oct 18, 2002 at 04:18:54PM -0400, Jon Whitener wrote:
> 
>> I found in the docs about the
>>
>>  tag(height=None, width=None, alt=None, scale=0, xscale=0, yscale=0, **args)
>>
>> method of an Image object, but I have no idea how to access or
>>modify that stuff.
> 
> 
> <div tal:replace="structure python:here.menu_icon.tag(class='menu-icon')" />
> 
> The tag() method of the image will put in height, width and alt
> itself, and also includes any arguments you give it as attributes in
> the IMG tag.
> 
> 
> 
>>I'm glad the WIDTH and HEIGTH are included automagically, but how can I:
>> - Leave out the BORDER attribute?  I don't know how that got in there.
> 
> 
> You can't with image_object.tag(), but border=0 is a fairly harmless
> default, isn't it?
> 
> Felix.