Is XHTML really format free?

Discussion in 'XML' started by Don Adams, Dec 1, 2003.

  1. Don Adams

    Don Adams Guest

    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
     
    Don Adams, Dec 1, 2003
    #1
    1. Advertising

  2. Don Adams

    Dean Tiegs Guest

    "Don Adams" <> 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/
     
    Dean Tiegs, Dec 1, 2003
    #2
    1. Advertising

  3. Don Adams

    Don Adams Guest


    > > 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
     
    Don Adams, Dec 1, 2003
    #3
  4. Don Adams

    Uwe Nowak Guest

    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
     
    Uwe Nowak, Dec 2, 2003
    #4
  5. Don Adams

    True Gamer Guest

    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
    >
    >
     
    True Gamer, Dec 4, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amir
    Replies:
    3
    Views:
    621
  2. nc
    Replies:
    1
    Views:
    528
    nice.guy.nige
    Feb 3, 2005
  3. Replies:
    2
    Views:
    367
  4. george
    Replies:
    0
    Views:
    1,197
    george
    Aug 29, 2008
  5. mohammed_a_o
    Replies:
    0
    Views:
    319
    mohammed_a_o
    Nov 30, 2010
Loading...

Share This Page