Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Is XHTML really format free?

Reply
Thread Tools

Is XHTML really format free?

 
 
Don Adams
Guest
Posts: n/a
 
      12-01-2003
Is XHTML really format free? Here's what I'm
struggling with...

I am switching my structured FrameMaker documentation from
docbook-based SGML to XHTML1.1-based XML.
In SGML, I used the following to define a section:

<section>
<title>Section Title</title>
<para>First paragraph under the section.</para>
</section>

This allowed me to nest sections and the format of
the heading (the <title> element) would change based on
the nested level of the section. For example, a <section>
nested under a parent <section> would use a second-level heading
format for the <title> element (using FrameMaker's EDD to
control the format -- similar to style sheets).

In XHTML1.1, I am using the following:

<div class="section">
<h1>Section Title</h1>
<p>First paragraph under the section.</p>
</div>

This still allows me to nest sections and the format of the
heading (the <h1> element) changes based on the nested level
of the <div class="section"> element. For example, a <div class="section">
nested under a parent <div class="section"> uses a second-level heading
format for the <h1> element (using stylesheets to control the format).

But, is this "proper" use of the <h1> XHTML element? If it is the
proper use, why have other heading elements (<h2>, <h3>, etc.) defined in
XHTML?
If it is not the proper use, how would you make the headings change based
on their nested level in the document structure?
(Note: changing all the <h3> elements to <h2> elements in a moved section
"by hand" is not an option.)

I understand the need/desire to have XHTML backward compatible with HTML,
but shouldn't a generic <h> element have been created to support format-free
XHTML?

--
Don Adams





 
Reply With Quote
 
 
 
 
Dean Tiegs
Guest
Posts: n/a
 
      12-01-2003
"Don Adams" <(E-Mail Removed)> writes:

> Is XHTML really format free?


I'm not sure what you mean by "format free". Do you mean "completely
lacking format"? That doesn't make sense.

> In XHTML1.1, I am using the following:
>
> <div class="section">
> <h1>Section Title</h1>
> <p>First paragraph under the section.</p>
> </div>
>
> This still allows me to nest sections and the format of the heading
> (the <h1> element) changes based on the nested level of the <div
> class="section"> element. For example, a <div class="section">
> nested under a parent <div class="section"> uses a second-level
> heading format for the <h1> element (using stylesheets to control
> the format).
>
> But, is this "proper" use of the <h1> XHTML element?


No. CSS style sheets are optional, and the user can override yours
with his, so you should design so that the XHTML structure is still
apparent without your author style sheets.

> If it is not the proper use, how would you make the headings change
> based on their nested level in the document structure? (Note:
> changing all the <h3> elements to <h2> elements in a moved section
> "by hand" is not an option.)


You could use an XSLT transformation that corrects the h1 ... h6
elements based on how deep they are nested in <div class="section">
elements.

> I understand the need/desire to have XHTML backward compatible with
> HTML, but shouldn't a generic <h> element have been created to
> support format-free XHTML?


It is proposed for XHTML 2.

--
Dean Tiegs, NE¼-20-52-25-W4
“Confortare et esto robustus”
http://telusplanet.net/public/dctiegs/
 
Reply With Quote
 
 
 
 
Don Adams
Guest
Posts: n/a
 
      12-01-2003

> > Is XHTML really format free?

> I'm not sure what you mean by "format free". Do you mean "completely
> lacking format"? That doesn't make sense.


What I mean is "structure" verses "format". (I probably should
have used the word "style" instead of "format"). To me, structure is
organization
of data and format is presentation of data. My philosophy is
that XHTML should contain structure only and formatting is done
with a stylesheet. However, the <h1> through <h6> elements
contradict this philosophy and, for me, are very difficult to deal with.

The reason <h1> - <h6> are difficult to deal with is that I need a way to
literally copy a
chunk of XHTML from one file, and paste it into another file and not have
to worry about changing <h3> elements to <h2>. The copy-and-paste
operation could be done with anything from a text editor to a
desktop publisher. I don't have control over how it's done, so I can't
write a program
to do the <h3> to <h2> conversion automatically.

My temporary solution is to make <h1> generic and format it
differently depending on what level it is in nested <div class="section">
elements. Like so:

<div class="section"><h1>text</h1></div> // This is a Level 1 heading

<div class="section">
<h1>text</h1> // This is a Level 1 heading
<div class="section">
<h1>text</h1> // This is a Level 2 heading
</div>
</div>

> > But, is this "proper" use of the <h1> XHTML element?

>
> No. CSS style sheets are optional, and the user can override yours
> with his, so you should design so that the XHTML structure is still
> apparent without your author style sheets.


I agree, which is why I wanted to see if anyone else had
a better way. I thought about <p class="heading"> instead of <h1> but
then I loose all format if a stylesheet is not used.

--
Don


 
Reply With Quote
 
Uwe Nowak
Guest
Posts: n/a
 
      12-02-2003
Don Adams wrote:
> The reason <h1> - <h6> are difficult to deal with is that I need a way to
> literally copy a
> chunk of XHTML from one file, and paste it into another file and not have
> to worry about changing <h3> elements to <h2>. The copy-and-paste
> operation could be done with anything from a text editor to a
> desktop publisher. I don't have control over how it's done, so I can't
> write a program
> to do the <h3> to <h2> conversion automatically.


The W3C ist thinking about dropping h1 to h6 out of the stnadard xtml
2.0. (see working draft of XHTML 2.0 in W3C). In version 1.0 and 1.1
theses tags were included because otherwise xhtml documents would have
been incompatible to older standards.

So one single documents can be format free, just use h1 to h6 in the
right structure and define Layout with CSS. But you cannot preserve the
structure if you copy the document as an subsection of another document.

Good bye,
Uwe

 
Reply With Quote
 
True Gamer
Guest
Posts: n/a
 
      12-04-2003
What you should do instead of <h1> is <span class="whatever">. The span
element is for describing inline style and you should use <div> for
separate paragraphs like h1 can be used for. Just remember that if you
define a class and the user doesn't define that element or that class
that yours is used. You could even dump the dtd and make up your own
element to be generic. I use XHTML for designing websites. It is
important to make every site compatible with any browser. The only
problem with a made-up element is that I'm not sure that it works in
Netscape-compatible browsers though. You should get a
Netscape-compatible browser and a version of Internet Explorer and try
it on both. If you really need to have XHTML 2, you could make a DTD
and have parts of it look generic.
---------------------------------------------------------------------------
Don Adams wrote:

>>>Is XHTML really format free?

>>
>>I'm not sure what you mean by "format free". Do you mean "completely
>>lacking format"? That doesn't make sense.

>
>
> What I mean is "structure" verses "format". (I probably should
> have used the word "style" instead of "format"). To me, structure is
> organization
> of data and format is presentation of data. My philosophy is
> that XHTML should contain structure only and formatting is done
> with a stylesheet. However, the <h1> through <h6> elements
> contradict this philosophy and, for me, are very difficult to deal with.
>
> The reason <h1> - <h6> are difficult to deal with is that I need a way to
> literally copy a
> chunk of XHTML from one file, and paste it into another file and not have
> to worry about changing <h3> elements to <h2>. The copy-and-paste
> operation could be done with anything from a text editor to a
> desktop publisher. I don't have control over how it's done, so I can't
> write a program
> to do the <h3> to <h2> conversion automatically.
>
> My temporary solution is to make <h1> generic and format it
> differently depending on what level it is in nested <div class="section">
> elements. Like so:
>
> <div class="section"><h1>text</h1></div> // This is a Level 1 heading
>
> <div class="section">
> <h1>text</h1> // This is a Level 1 heading
> <div class="section">
> <h1>text</h1> // This is a Level 2 heading
> </div>
> </div>
>
>>>But, is this "proper" use of the <h1> XHTML element?

>>
>>No. CSS style sheets are optional, and the user can override yours
>>with his, so you should design so that the XHTML structure is still
>>apparent without your author style sheets.

>
>
> I agree, which is why I wanted to see if anyone else had
> a better way. I thought about <p class="heading"> instead of <h1> but
> then I loose all format if a stylesheet is not used.
>
> --
> Don
>
>


 
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
PSD to XHTML Conversion, PSD to HTML, Joomla, Drupal, WordpressConversion, PSD to XHTML CSS xhtml champs XML 0 08-02-2011 05:40 AM
PSD to XHTML Conversion, PSD to HTML, Joomla, Drupal, WordpressConversion, PSD to XHTML CSS xhtml champs C Programming 0 08-01-2011 06:29 AM
convert xhtml to another xhtml using xslt Usha2009 XML 0 12-20-2009 01:13 PM
Should I Convert Site To XHTML or XHTML mobile? chronos3d HTML 9 12-05-2006 04:46 PM
parse URL (href) from xhtml, xhtml -> text, for data hawat.thufir@gmail.com XML 7 02-08-2006 07:39 PM



Advertisments