Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > italics in xml

Reply
Thread Tools

italics in xml

 
 
ezmiller
Guest
Posts: n/a
 
      11-08-2005
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?,transl ator?,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*)>

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      11-08-2005
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.
 
Reply With Quote
 
 
 
 
ezmiller
Guest
Posts: n/a
 
      11-08-2005
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?

 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      11-08-2005
ezmiller wrote:

> 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 <(E-Mail Removed)>
in c.t.t.

///Peter
--
XML FAQ: http://xml.silmaril.ie/

 
Reply With Quote
 
ezmiller
Guest
Posts: n/a
 
      11-11-2005
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.)

 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      11-12-2005
ezmiller wrote:

> 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>
</xsl:template>

> (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
 
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
i want to change font_style (hyper link<a href...>text</a>) normal to italics,when load a page..? ajaspersonal@gmail.com ASP .Net 3 03-09-2007 11:02 AM
Extracting bolds and italics from HTML Ezee Java 1 07-26-2005 06:28 PM
All my windows fonts are in Italics Berry West Computer Support 4 10-28-2004 07:46 PM
Thunderbird displaying messages in italics Martin J Hooper Firefox 1 09-30-2004 02:14 PM
MailMessage Body appear in italics =?Utf-8?B?bWc=?= ASP .Net 1 02-08-2004 02:31 AM



Advertisments