Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > XHTML style attribute

Reply
Thread Tools

XHTML style attribute

 
 
Michael Fesser
Guest
Posts: n/a
 
      03-02-2008
..oO(Jonathan N. Little)

>Michael Fesser wrote:
>> .oO(Jonathan N. Little)
>>
>>> Michael Fesser wrote:
>>>
>>>> This would lead to a hundred additional IDs in my stylesheets, simply
>>>> because every page may have its own purely decorational side image.
>>>> The markup for this is generated by a script and uses an inline style
>>>> to define the 'background-image' property.
>>> No, you can put page specific styles in a style element in the head.

>>
>> Correct. Might be an option if I find the time to rewrite that script.
>>

>
>Rewrite that script?


I have to rewrite/modify my PHP scripts that generate the markup for the
side image and the document header. Not that difficult, but other things
are more important at the moment.

Micha
 
Reply With Quote
 
 
 
 
XHTML
Guest
Posts: n/a
 
      03-02-2008
Jonathan N. Little wrote:
> And the added benefit of when you use XHTML 1.1 you can alienate all
> those IE users!


I need to use XHTML because of XML+XLST.

And as for website pages, I use PHP to transform from XHTML to HTML. It
intoduces some overhead, but it's working fine.
 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      03-02-2008
Michael Fesser wrote:

> I have to rewrite/modify my PHP scripts that generate the markup for the
> side image and the document header. Not that difficult, but other things
> are more important at the moment.


I see, depends on how you template your pages.

<?php
//include page specific style base on pageName
if(file_exists( "./inc/styles/${pageName}.php" )) {
include_once("./inc/styles/${pageName}.php");
}
//include page specific javascript base on pageName
if(file_exists( "./inc/js/${pageName}.php" )) {
include_once("./inc/js/${pageName}.php");
}
?>
</head>
....





--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      03-02-2008
XHTML wrote:
> Jonathan N. Little wrote:
> > And the added benefit of when you use XHTML 1.1 you can alienate all
>> those IE users!

>
> I need to use XHTML because of XML+XLST.
>
> And as for website pages, I use PHP to transform from XHTML to HTML. It
> intoduces some overhead, but it's working fine.


Pain in the tookas though!

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      03-03-2008
On 2 Mar, 21:16, XHTML <ime.prez...@fer.hr> wrote:

> I need to use XHTML because of XML+XLST.


Two points:

* XHTML 1.0 isn't the same thing as XHTML 1.1

It's possible to use XHTML 1.0 on the web by falling back on Appendix
C. It's impossible to use XHTML 1.1 on the web correctly. You either
rule out access from IE, or you have to break the recommendation. If
you _must_ use XHTML (which isn't usually a good idea anyway), make it
XHTML 1.0 Appendix C, not XHTML 1.1

* You can generate HTML 4.01 from XSLT more easily than you can create
usable XHTML with it. HTML from XSLT is easy, Appendix C is hard.
 
Reply With Quote
 
XHTML
Guest
Posts: n/a
 
      03-03-2008
Andy Dingley wrote:
> * XHTML 1.0 isn't the same thing as XHTML 1.1


On offline pages (XML+XLST) I use XHTML and use XHTML compliant browser
to see the content. No problems here.

On public pages I use XHTML but based on header sent from browser I fail
back to HTML 4.01 Strict.

The question isn't really about weather I should use HTML or XHTML. I've
decided I'll go with XHTML. I opened this thread to clarify style
attribute deprecation. It validates even with style attribute so I was
unsure.

To what are you referring when you say that 1.0 isn't the same thing as 1.1?
Is it the Content-Type header? As I understood, 1.0 Strict is pretty
much the same to 1.1, except for some minor differences.


> * You can generate HTML 4.01 from XSLT more easily than you can create
> usable XHTML with it. HTML from XSLT is easy, Appendix C is hard.


Can you provide me with an example. If I use this XSLT document I get an
error.

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<head>
<title>Some title</title>
</head>
<body>
<br>
</body>
</html>
</xsl:template>

</xsl:stylesheet>


As to my understanding, I must use XHTML in conjunction with XML+XLST
because they are both XML languages and HTML doesn't fit.
 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      03-03-2008
Scripsit XHTML:

> I opened this thread to clarify style
> attribute deprecation. It validates even with style attribute so I was
> unsure.


Deprecation pretty much implies that it validates: a deprecated feature
is normally something included into the formal specification (such as a
DTD) but declared deprecated.

> As I understood, 1.0 Strict is pretty much the same to 1.1, except for
> some minor differences.


You have been misled by the W3C. There are numerous differences that
have not been documented in the proper place but are formally implied by
DTD differences. I never listed down all the differences, for two good
reasons:
1) It would mean a lot of work, and nobody offered to pay me half a cent
for doing the spec writers' work.
2) XHTML 1.1 is an exercise in futility.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      03-03-2008
On 3 Mar, 11:24, XHTML <ime.prez...@fer.hr> wrote:
> Andy Dingley wrote:
> > * XHTML 1.0 isn't the same thing as XHTML 1.1

>
> On offline pages (XML+XLST) I use XHTML and use XHTML compliant browser
> to see the content. No problems here.


That's OK for you, but IE isn't compatible with conformant XHTML,
other than XHTML 1.0 with Appendix C. This can be a problem for the WWW.

You need to fix this for web use. You can either hack it, or you can
do it at least nominally correctly (XHTML 1.0 and Appendix C), or you
can (best option) revert to HTML 4.01

> On public pages I use XHTML but based on header sent from browser I fail
> back to HTML 4.01 Strict.


Two pages for the same content is a waste of effort. It hurts server
load and cache performance. Even switching Content-type by browser can
hurt caching. As there's no advantage to serving this XHTML, why do
it?


> The question isn't really about weather I should use HTML or XHTML.


As the wrong question, you're bound to get the wrong answer.

Until you can arm-wrestle Jukka and win with your convincing
justification of XHTML, then you shouldn't use it. I don't deny the
existence of appropriate uses for it, but they're rare and require
skill. If you can't demonstrate this, you're better off avoiding it.

> To what are you referring when you say that 1.0 isn't the same thing as 1.1?


There are 3 relevant differences at least:

* No more XHTML (1.0) Transitional, XHTML 1.1 is all "Strict"

* No more Appendix C, so you _cannot_ serve conformant XHTML 1.1 to IE
and have it work. You just can't do this. If you try, you're no longer
conformant.

* XHTML 1.1 is sniffy about style attributes (can't remember if it's
formally deprecated or just disapproved of).


> > * You can generate HTML 4.01 from XSLT more easily than you can create
> > usable XHTML with it. HTML from XSLT is easy, Appendix C is hard.

>
> Can you provide me with an example.


Look up the <xslutput> element, or simply add this to your
stylesheet:

<xslutput
method="html"
version="4.01"
omit-xml-declaration="yes"
standalone="yes"
doctype-public="-//W3C//DTD HTML 4.01//EN"
doctype-system="http://www.w3.org/TR/html4/strict.dtd"
encoding="utf-8"
cdata-section-elements="script style pre"
indent="yes"
media-type="text/html"
/>


> If I use this XSLT document I get an error.


> <body>
> <br>
> </body>


That's because that document isn't XML (not well-formed) so thus can't
be XSLT. This issue is about whether the _source_ document (the XSLT
"program") is XML or not. What is generated by the XSLT output
serializer is a different question. Using "<br/>" is the appropriate
way to code a linebreak in an XSLT stylesheet to generate HTML 4.01.
The output of this (using the <xslutput> element above) will be
"<br>".

It's easier to do this than it is to guarantee that an XSLT stylesheet
with <xslutput method=xml" /> will never generate "<br></br>" in an
XHTML Appendix C document.


> As to my understanding, I must use XHTML in conjunction with XML+XLST
> because they are both XML languages and HTML doesn't fit.


No. Source code isn't the same as the generated output. You get the
same issue with technologies like JSF Facelets too.
 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      03-03-2008
Scripsit Andy Dingley:

> * No more Appendix C, so you _cannot_ serve conformant XHTML 1.1 to IE
> and have it work. You just can't do this. If you try, you're no longer
> conformant.


It depends. It seems that the XHTML 1.1 draft that now resides at
http://www.w3.org/TR/xhtml11/
(superseding the XHTML 1.1 _specification_ at that address!) says (note
the order!):

"XHTML 1.1 documents SHOULD be labeled with the Internet Media Type
text/html as defined in [RFC2854] or application/xhtml+xml as defined in
[RFC3236]."

So using text/html is explicitly allowed, and you don't need any
particular permission to apply "HTML Compatibility Guidelines", which
are just an informative description of an authoring style.

And it has Appendix C, though different from App. C of XHTML 1.0.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
XHTML
Guest
Posts: n/a
 
      03-03-2008
Andy Dingley wrote:
> IE isn't compatible with conformant XHTML,


As I see it, this is the biggest disadvantage of XHTML. If, for the sake
of discussion, we ignore that fact, I really don't see any other
disadvantage of XHTML.


> Two pages for the same content is a waste of effort. It hurts server
> load and cache performance.


Yeah, I agree on you on this. For this transformation I'm loosing about
5 ms per page. Even though it's not much, when multiplied by number of
page hits, it could be significant. On the other hand, I'm using
significally more time on database connection and data retrival, so at
the end this doesn't sound so bad.


> As there's no advantage to serving this XHTML, why do it?


I disagree with you on this. I see the strict syntax of XHTML (XML) as a
good thing. If we look at the page solely as the static final product,
then yeah, it's pretty much the same weather I use HTML or XHTML. But in
a long run, it might be easier to use DOM in JavaScript and to reuse code.
It's pretty much the matter of a choice. For instance, some might like
the fact of the loose type definition in JavaScript because they don't
have to worry about defining the type, but I like strict type
definition. Other example is try - catch block. You can write your
program without any of them but they bring some extra benefit to your
code. The same is with HTML. Sure, you can write any XHTML document as
HTML, but XHTML have some benefits because of the strict syntax and
making XHTML code clearer.


> Until you can arm-wrestle Jukka and win with your convincing
> justification of XHTML, then you shouldn't use it. I don't deny the
> existence of appropriate uses for it, but they're rare and require
> skill. If you can't demonstrate this, you're better off avoiding it.


Strict syntax. The major disadvantage of XHTML is lack of support in
some browsers.


> * No more XHTML (1.0) Transitional, XHTML 1.1 is all "Strict"


I was writing Strict code before, so I don't take this as a bad thing.
The thing I missed on a few occasions is a Frameset DTD (for some
internal use).

> * No more Appendix C, so you _cannot_ serve conformant XHTML 1.1 to IE
> and have it work. You just can't do this. If you try, you're no longer
> conformant.


As I understood from Jukka's last post and as I read from the XHTML 1.1
(draft) page, the problem is solved (IE and similar browsers get tag
soup, but they display the page).


> * XHTML 1.1 is sniffy about style attributes (can't remember if it's
> formally deprecated or just disapproved of).


Sorry, I didn't follow you on this one.


> Look up the <xslutput> element, or simply add this to your
> stylesheet:


Didn't know about <xslutput>. Don't think I'm gonna use it, but thanks
for the info.




I don't see a point in HTML tags like <address> and some others. OK, we
have a tag to use to write addresses, but what's with the <phone> tags?
I find <address> and some other tags totally useless.
One last thing. What do you see as a biggest disadvantage of creating
your own XML Schema for the "HTML"? I created a small test page months
ago and tested it in IE and FireFox. Basically, this is the story: I
create XML Schema, create XML document and XLST file that transforms my
XML to XHTML. It's working fine, but I'm concerned about downsides of
making those pages public. I think I can count off all mobile devices
then, can't I?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation (XHTML 1.0 Transitional): Attribute 'height' is not a valid attribute of element 'table' perspolis ASP .Net 1 01-23-2007 07:57 AM
Validation (XHTML 1.0 Transitional) - Attribute..... is not a valid attribute of..... Radu ASP .Net 2 01-03-2007 03:41 PM
Validation (XHTML 1.0 Transitional): Attribute 'leftmargin' is not a valid attribute of element 'body'. anonymous ASP .Net 1 08-02-2006 08:05 AM
parse URL (href) from xhtml, xhtml -> text, for data hawat.thufir@gmail.com XML 7 02-08-2006 07:39 PM
Need help with Style conversion from Style object to Style key/value collection. Ken Varn ASP .Net Building Controls 0 04-26-2004 07:06 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57