italics in xml

E

ezmiller

This quesiton may be somewhat complex.


To explain it I have to describe my project briefly. I have designed a

series of dtds that describe documents including a citation of a book
and then what I've termed <note_session>s. The note sessions contain
<notes> with <chapters> with <sections>, and finally <args> , where the

<arg> is the fundamental element of note taking...it includes <text>
and <quote>... So in the end I have a structured notes docuemnt that is

also resolvable into individual <arg>s.


My question and problem is this. When taking notes, especially
quoting, I need to be able to accuratley preserve text that may be
italicized. I don't know how to do this, though. At the moment, I
have enabled <text> and <quote> elements to also include <italic>
elements, so text that has been italicized is wrapped in a sub-selement

<italic>. But this is not really a solution, because I don't know how
to actually make the text italicized....


Any ideas? I'm going to attach my dtd below just to show you.


Best,
Ethan


---------


<!ELEMENT book (citation, note_session*)>


<!ELEMENT citation
(authorID+,book_title,series_title?,editor?,translator?,publisher,place_of_­pub,date_of_pub,citation_note?)>

<!ELEMENT note_session (read_for,date,synopsis?,crit_com?, (notes |
random_notes)*)>


<!-- The citation elements -->
<!ELEMENT authorID (#PCDATA)>
<!ELEMENT book_title (#PCDATA)>
<!ELEMENT series_title (#PCDATA)>
<!ELEMENT editor (#PCDATA)>
<!ELEMENT translator (#PCDATA)>
<!ELEMENT publisher (#PCDATA)>
<!ELEMENT place_of_pub (#PCDATA)>
<!ELEMENT date_of_pub (#PCDATA)>
<!ELEMENT citation_note (#PCDATA)>


<!-- The note_session elements -->
<!ELEMENT read_for (#PCDATA)>
<!ELEMENT date (day?, month, year)>
<!ELEMENT day (#PCDATA)>
<!ELEMENT month (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT synopsis (#PCDATA)>
<!ELEMENT crit_com (#PCDATA)>
<!ELEMENT notes (part | chapter | arg | comment)*>


<!-- Note elements -->
<!ELEMENT part (chapter*)>
<!ATTLIST part title CDATA #IMPLIED>
<!ELEMENT chapter (chapter_title,chapter_summary?, (section | arg |
data | comment)*)>
<!ELEMENT chapter_title (#PCDATA)>
<!ELEMENT chapter_summary (#PCDATA)>
<!ELEMENT section ((arg | comment)*)>
<!ATTLIST section title CDATA #IMPLIED>


<!--
Arg element: This element has both text and quotes. It is either a
piece of info,
indicated by the datatype attribute as "info," or an essential logical
step in the author's
argument, indicated by the datatype attribute as "idea".
-->
<!ELEMENT arg (keywords?, text, quote*, comment*)>
<!ATTLIST arg datatype (idea | info | quote) "idea">
<!ELEMENT keywords (#PCDATA)>
<!ELEMENT text (#PCDATA | quote | italic)*>
<!ELEMENT quote (#PCDATA | italic)*>
<!ATTLIST quote authorID CDATA #IMPLIED>
<!ELEMENT comment (#PCDATA)>
<!ELEMENT italic (#PCDATA)>


<!--
Random notes: This element provides a way to take notes that is not so
much about
the close reading and tracing of the text's logic. Instead, it is for
notes that are more
units of information and which are targeted. Instead of the arg
element it has a card
element.
-->
<!ELEMENT random_notes ((card | comment)*)>


<!--
Card element: This element is exactly the same as the arg element
except that it requires
keywords.
-->
<!ELEMENT card (keywords, text,quote*,comment*)>
 
A

Andrew Thompson

ezmiller wrote:

..At the moment, I
have enabled <text> and <quote> elements to also include <italic>
elements, so text that has been italicized is wrapped in a sub-selement

<italic>. But this is not really a solution,

Sure it is - not in itself though.
.. because I don't know how
to actually make the text italicized....

XML really about representing data and its structure - as
opposed to 'presenting' the actual styles those
data/structures might define.

You mught use an XSLT to transform the XML to an HTML
representation for viewing though, then you can see the
italics.
 
E

ezmiller

Ok, I get that distinction--that xml represents data structures and
data, but not its presentation--but how then should I accomplish that
transformation in xsl. I also have a series of xsl apps that do
transformations. I'll show you one of the template for the <arg>
elements:

<xsl:template match="arg">
<ul> <li>
<xsl:value-of select="text"/>
<!--
If there are quotes, and if they are separated out from the text,
print them out.
-->
<xsl:if test="string-length(quote) &gt; 0">
<div style="color:green">
<ul>
<xsl:for-each select="quote">
<li><xsl:value-of select="."/></li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
<!-- If there are comments print them. -->
<xsl:if test="string-length(comment) &gt; 0">
<ul>
<xsl:for-each select="comment">
<div style="font-style:italic">
<li>
<xsl:text>Comment:</xsl:text>
<xsl:value-of select="."/>
</li>
</div>
</xsl:for-each>
</ul>
</xsl:if>
<!-- If there are keywords print them. -->
<xsl:if test="string-length(keywords) &gt; 0">
<div style="color:blue">
<xsl:text>{</xsl:text>
<xsl:value-of select="keywords"/>
<xsl:text>}</xsl:text>
</div>
</xsl:if>
</li></ul>
</xsl:template>

I can't figure out how I would modify this code so that text within the
<text> element that is within an <italic> element would be
printed in italics. So I guess my question is how to do this?
 
P

Peter Flynn

ezmiller said:
This quesiton may be somewhat complex.


To explain it I have to describe my project briefly. I have designed
a

series of dtds that describe documents including a citation of a book
and then what I've termed <note_session>s. The note sessions contain
<notes> with <chapters> with <sections>, and finally <args> , where
the

<arg> is the fundamental element of note taking...it includes <text>
and <quote>... So in the end I have a structured notes docuemnt that
is

also resolvable into individual <arg>s.

One thing springs to mind immediately: have you looked at using TEI
for this? It appears to have all the features you want (and more,
perhaps a bit too much more), but it is the accepted standard for
textual-analytical recording and is very heavily supported in software.
My question and problem is this. When taking notes, especially
quoting, I need to be able to accuratley preserve text that may be
italicized. I don't know how to do this, though. At the moment, I
have enabled <text> and <quote> elements to also include <italic>
elements, so text that has been italicized is wrapped in a
sub-selement

<italic>. But this is not really a solution, because I don't know how
to actually make the text italicized....

Don't. As Andrew pointed out, XML is intended for recording function or
meaning: it's perfectly possible to use if for recording appearances,
but except in rare circumstances this is not as useful as recording
_why_ the text was italicised (sometimes you may not know why, so in
those cases all you can do is record the appearance, but this is not
common). I described this yesterday in <[email protected]>
in c.t.t.

///Peter
 
E

ezmiller

This still does not answer my question though. If I have recorded an
appearance within the xml by tagging data within a <text> element by
wrapping it in an <italic> element, how then, can I transform this in
the right way using XSL?

(I had not heard of TEI. It looked it up, and it looks useful, but it
is designed for documents rather than notes documents which is what I
have tried to make.)
 
P

Peter Flynn

ezmiller said:
This still does not answer my question though. If I have recorded an
appearance within the xml by tagging data within a <text> element by
wrapping it in an <italic> element, how then, can I transform this in
the right way using XSL?

By writing a template for the italic element which outputs the
content in italics. In XSLT-for-HTML this would be

<xsl:template match="italic">
<i>
<xsl:apply-templates/>
</i>
(I had not heard of TEI. It looked it up, and it looks useful, but it
is designed for documents rather than notes documents which is what I
have tried to make.)

I'm not really sure I understand what a "notes document" is, but that's
probably not important for me :)

///Peter
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top