Translating XML -> HTML & RTF

John E. Simpson simpson at polaris.net
Sat Jan 23 16:04:11 GMT 1999


At 03:12 PM 1/23/99 +0000, Tony McDonald wrote:
><studyguide title='Organisation of Tissues'>
>...
><section title='Core Content' sg_title='Organisation of Tissues'> *1*
	[snip]
></section> *2*
>...
></studyguide>
>
>I'm using an Expat enabled parser to scan the resultant documents and 
>(try) to do the translations.
>
>...I would like the <section>..</section> tag to be replaced by a <h2 
>class="section">Core Content: Organisation of Tissues</h2> construct, 
>but using expat, I end up with the closing </h2> tag at the line 
>marked *2* above.

I think expat is doing exactly what you asked it to do: turning all of the
section element's content into <h2>. One way to fix it might be to turn the
title and sg_title attributes into full-blown child elements of the section
element, and enclose them in something like a titleinfo wrapper to which
you can apply your desired class attribute. Something like this:

  <section>
    <titleinfo class="section">
      <title>Core Content</title>
      <sg_title>Organisation of Tissues</sg_title>
    </titleinfo>
     ...
  </section>

This seems to be a good illustration of one argument in favor of using
elements vs. attributes: when you want the content to be easily displayed.

Will be interested to see others' replies, if any.
=================================================
John E. Simpson
simpson at flixml.org
http://www.flixml.org
Just XML - Now available from Prentice-Hall

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list