Re: Bottom-up Sections

Mikko Rantalainen <mira@st.jyu.fi> writes:
>How about something like this:
><section>
>Blah blah blah
><section title="Example">blah blah</section>
>"blah blah
><section title="Figure"><object>...</object></section>
>blah blaa.
></section>

  The attribute name "title" might be misleading, because 
  the contents of this attribute is the /kind/ of the 
  block, not the title. It might have an independent title
  (element of type "h"):

<section kind="exercise"> 
  <h>Sum of two numbers</h> 
  <p>Find the sum of the numbers 7 and 14 and write it down.</p> 
</section>

  This might be rendered as

EXERCISE   Sum of two numbers
  Find the sum of the numbers 7 and 14 and write it down.

  I am using the element type names "block" and "caption"
  from now on, as suggested by Daniel Brockman. Instead
  of "role", the atribute name "rel" might be reused. The 
  type of block is specified by a "kind" attribute now.
  (The attribute name "type" might be misleading,
  because in XML the type of an elements is given by the
  identifier at the start of the start tag.) The attribute 
  "class" should be left for the user, e.g., to "subclass"
  several different classes of "exercises" by a class-value.
 
  Blocks might be nested. An example:

<block kind="exercise">
  <caption>Sum of two numbers</caption>
  <p>Find the sum of the numbers 7 and 14 and write it down.</p>
  <block kind="hint">
    <p>Try to add 10 to 7 first, and then add 4 to the result
    or use the following program.</p>
    <block kind="listing">
      <caption>sum2.bas</caption>
      <pre>10 PRINT 7 + 14</pre>
    </block>
  </block>
</block>

EXERCISE   Sum of two numbers
  Find the sum of the numbers 7 and 14 and write it down.

  HINT
    Try to add 10 to 7 first and then add 4 to the result
    or use the following program.

    LISTING   sum2.bas
      10 PRINT 7 + 14

>[1] Obviously, taking the value of title and adding 's' doesn't create 
>correct plurar form for that many languages. Is this something that 
>needs to be solved on markup level or can it be solved with CSS?

  For the attribute names, it might be most foolproof to always use
  the singular, i.e., "exercise" as value of "containsonly", when
  blocks are used as list items and the author wants to express that
  the list may only contain blocks of a certain kind.

<ol containsonly="exercise">
  <block type="exercise">
    <caption>Sum of two numbers</caption>
    <p>Find the sum of the numbers 7 and 14 and write it down.</p>
  </block>
  <block type="exercise>
    <caption>Sum of three numbers</caption>
    <p>Find the sum of the numbers 7, 14, and 12. Write the sum
    on a piece of paper.</p>
    <block class="hint">
      <p>Solve the preceding exercise first. You then know
      the sum of 7 and 14. Use this result to find the sum of
      7, 14, and 12.</p>
    </block>
  </block>
</ol>

  Which might be rendered - assuming it appears in chapter 17 - 
  as follows:

EXERCISES
---------

EXERCISE 17.1  Sum of two numbers
  Find the sum of the numbers 7 and 14 and write it down. 

EXERCISE 17.2  Sum of three numbers
  Find the sum of the numbers 7, 14, and 12. Write the sum
  on a piece of paper.

    HINT
      Solve the preceding exercise first. You then know
      the sum of 7 and 14. Use this result to find the sum 
      of 7, 14, and 12.

  There also should be a list of kinds recommended and
  possible roles of captions or paragraph sub-elements.
  Possibly the list might come from another party (like
  the Dublic Core names), but it would be helpful to 
  have such a list, to avoid inventing different names for
  the same or similar meanings.

  For example, once the block kind "listing" with "name" and
  "source" is standardized, user-agents might offer to safe 
  such a block to a file, suggesting the block-name as file 
  name. The block kind "description" might inspire to build 
  some tools to convert description lists to/from an RSS- or 
  other RDF-file. 

    definition        <!-- a block kind -->
      term            <!-- caption rel-attribute --> 
      description     <!-- rel-attribute for other contents -->
    listing
      name
      source
    description       <!-- of a resource or a thing or a person -->
      name
      address         <!-- e.g., a URI or ISBN -->
      description
      kind            <!-- e.g., "link-list" -->
    utterance         <!-- as in a drama or an interview -->
      speaker
      words 
    questionandanswer <!-- as in an FAQ -->
      question
      answer
    translation
      term
      translation
    production        <!-- a production like in EBNF [1] -->
      symbol
      construction 
    proof
    theorem
    remark
    example
    rule
    warning 
    hint
    quote
    exercise
    question          <!-- as an exercise to the reader -->
    solution          <!-- to an exercise -->
    abstract

  The current XHTML 2 draft allows the caption-Element as a sub-element
  of a table or object. So an additional wrapper-block around this is
  not neccessary. Possibly, one also might have captions for lists?
  In which case a block-kind "list" might be used as a wrapper or the
  caption sub-element might be allowed within an ol/ul-element.

  [1] An EBNF production is not a definition, because IIRC there might
  be multiple possible productions with the same left side and
  different right sides.

  If a document is written in another language than English, 
  e.g. German, the English names should still be 
  used as values of the attributes "kind" and "rel", while the 
  user-agent (possibly supported by CSS) renders the block observing 
  an enclosing xml:lang-attribute. So:

<block kind="exercise" xml:lang="de">
  <caption>Summe zweier Zahlen</caption>
  <p>Ermitteln Sie die Summe von 12 und 5.</p>
</block>

  might be rendered as:

AUFGABE   Summe zweier Zahlen
  Ermitteln Sie die Summe von 12 und 5.

  Or - as a variant using another CSS -

@ Summe zweier Zahlen
  Ermitteln Sie die Summe von 12 und 5.

  A user-agent should not be required to know the translation
  of "Exercise" into all possible languages, an alternative
  is not to render the kind at all, as in:

Sum of two numbers
  Find the sum of the numbers 7 and 14 and write it down.

  For each block type, there might be default roles of captions and
  other elements, so that in the following block the rel-attributes
  might be omitted because they have the default values. (For a
  block of type "listing" the default role of the caption is the
  name of the listing and the default role of any other content is
  the source code itself).

    <block kind="listing">
      <caption rel="name">sum2.bas</caption>
      <pre rel="source">10 PRINT 7 + 14</pre>
    </block>

  Using the default roles, this can be written shorter as: 

    <block kind="listing">
      <caption>sum2.bas</caption>
      <pre>10 PRINT 7 + 14</pre>
    </block>

-- 
http://purl.net/stefan_ram/

Received on Sunday, 10 August 2003 18:25:14 UTC