italics in xml

Discussion in 'XML' started by ezmiller, Nov 8, 2005.

  1. ezmiller

    ezmiller Guest

    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*)>
     
    ezmiller, Nov 8, 2005
    #1
    1. Advertising

  2. 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.
     
    Andrew Thompson, Nov 8, 2005
    #2
    1. Advertising

  3. ezmiller

    ezmiller Guest

    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?
     
    ezmiller, Nov 8, 2005
    #3
  4. ezmiller

    Peter Flynn Guest

    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 <>
    in c.t.t.

    ///Peter
    --
    XML FAQ: http://xml.silmaril.ie/
     
    Peter Flynn, Nov 8, 2005
    #4
  5. ezmiller

    ezmiller Guest

    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.)
     
    ezmiller, Nov 11, 2005
    #5
  6. ezmiller

    Peter Flynn Guest

    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
     
    Peter Flynn, Nov 12, 2005
    #6
    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. =?Utf-8?B?bWc=?=

    MailMessage Body appear in italics

    =?Utf-8?B?bWc=?=, Feb 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    434
    =?Utf-8?B?RGF2aWQgQ29l?=
    Feb 8, 2004
  2. Ezee
    Replies:
    1
    Views:
    414
    Harald
    Jul 26, 2005
  3. Replies:
    3
    Views:
    485
  4. Vamsi Krishna

    show text in italics.

    Vamsi Krishna, Jul 18, 2008, in forum: Ruby
    Replies:
    6
    Views:
    125
    Vamsi Krishna
    Jul 21, 2008
  5. Bob

    regexp test for italics and bold

    Bob, Oct 25, 2005, in forum: Javascript
    Replies:
    12
    Views:
    230
    Julian Turner
    Oct 26, 2005
Loading...

Share This Page