Images In Xml Essays
<h3 class="heading-h6"><a name="THLToolboxhomegtDevelopersZonegtXMLMarkupinTHLgtImagesinXMLEssays" class="anchorpoint"></a><a href="/tools/wiki/home.html">THL Toolbox</a> > <a href="/tools/wiki/Developers%27%20Zone.html">Developers' Zone</a> > <a href="/tools/wiki/XML%20Markup%20in%20THL.html">XML Markup in THL</a> > Images in XML Essays</h3><p class="paragraph">
</p><h3 class="heading-h1"><a name="ImagesinXMLEssays" class="anchorpoint"></a>Images in XML Essays</h3><p class="paragraph"><strong class="bold">Contributor(s)</strong>: Than Grove</p><p class="paragraph">In THL XML essays, the markup of images uses the <figure> element in TEI. The simplest figure tag is an empty tag that has two attributes, an "entity" attribute and a "rend" attribute. The entity attribute contains the name of an image entity declared at the top of the document and the rend attribute contains a predefined value for the alignment of the image. The rend attribute is actually optional and default to right justification of the image. The rend attribute can have the following values:</p><ul class="star"><li>left (float left allowing text to appear to the right of the image)</li>
<li>center (center the image in its own block, no text to either side)</li>
<li>right (float right allowing text to appear to the right of the image)</li>
<li>block (align left taking up the whole width of the article and not allowing text to appear to the right of the image)</li>
<li>noshadow (also align left as "block" but without the custom drop shadow styling)</li>
<li>inline (an inline image, usually smaller in size)</li></ul><p class="paragraph">The simplest figure tag would thus look like this:</p><div class="code"><pre><figure entity=<span class="java-quote">"img07b"</span> rend=<span class="java-quote">"right"</span>/></pre></div><p class="paragraph">Where the entity "img07b" is defined at the top of the document as:</p><div class="code"><pre><!ENTITY img07b SYSTEM <span class="java-quote">"http://www.thlib.org/<span class="java-keyword">static</span>/reprints/jiats/04/images/jiats04fox-img07b-sm.jpg"</span> NDATA JPG></pre></div><p class="paragraph">
</p><h3 class="heading-h2"><a name="Captions" class="anchorpoint"></a>Captions</h3><p class="paragraph">To include captions for an image, the <figDesc> child is included <em class="italic">within</em> the <figure> tag with the text of the caption inside it. This <figDesc> element can contain internal markup, plain text, or a combination of both. Thus, for an image with a caption the markup would look like:</p><div class="code"><pre><figure entity=<span class="java-quote">"img01"</span> rend=<span class="java-quote">"block"</span>>
<figDesc>Figure 1. Nomad herder’s camp at about five-thousand meters elevation in the northern
<geogName type=<span class="java-quote">"lake"</span>><name type=<span class="java-quote">"lake"</span> corresp=<span class="java-quote">"entry19"</span> lang=<span class="java-quote">"tib"</span> n=<span class="java-quote">"Aru"</span>>a ru</name> <geog>Basin</geog></geogName>,
<placeName corresp=<span class="java-quote">"entry11"</span> lang=<span class="java-quote">"eng"</span>>Rutok County</placeName>,
<placeName corresp=<span class="java-quote">"entry13"</span> lang=<span class="java-quote">"eng"</span>>Ngari Prefecture</placeName>,
within the <placeName><geogName corresp=<span class="java-quote">"entry1"</span> lang=<span class="java-quote">"tib"</span> n=<span class="java-quote">"Jangtang"</span>>byang thang</geogName>
Nature Reserve</placeName> on the western <geogName>Tibetan Plateau</geogName>.
Photo: Joseph Fox
</figDesc>
</figure></pre></div><p class="paragraph"><strong class="bold">Note:</strong> For side-by-side images (see below) with a single caption, the <figDesc> element should be given a rend="fullwidth".
</p><h3 class="heading-h2"><a name="Morethanoneimagesidebyside" class="anchorpoint"></a>More than one image side by side</h3><p class="paragraph">When one wants to place two or more images side by side in a row, special mark-up is required. One needs to place the individual figure tags within an <p> element whose rend attribute is set to "imgs". To ensure the proper positioning of two images, the first figure is given a rend="left" and the second rend="right". As mentioned above, when there is a single caption for both images the <figDesc> element is given a rend="fullwidth". Thus, the markup of such a situation is exemplified by:</p><div class="code"><pre><p rend=<span class="java-quote">"imgs"</span>>
<figure entity=<span class="java-quote">"img06a"</span> rend=<span class="java-quote">"left"</span>>
<figDesc rend=<span class="java-quote">"fullwidth"</span>>Figure 6. Fencing constructed in 2005 to delineate herding group grazing
boundaries at around 4,800-meter elevation in the northernmost inhabited areas of
<placeName corresp=<span class="java-quote">"entry15"</span> lang=<span class="java-quote">"eng"</span>>Drakpo Township</placeName>,
<placeName corresp=<span class="java-quote">"entry5"</span> lang=<span class="java-quote">"eng"</span>>Gertsé County</placeName>,
<placeName corresp=<span class="java-quote">"entry13"</span> lang=<span class="java-quote">"eng"</span>>Ngari Prefecture</placeName>, within
the <placeName><geogName corresp=<span class="java-quote">"entry1"</span> lang=<span class="java-quote">"tib"</span> n=<span class="java-quote">"Jangtang"</span>>byang thang</geogName>
Nature Reserve</placeName>. Photos: Joseph Fox
</figDesc>
</figure>
<figure entity=<span class="java-quote">"img06b"</span> rend=<span class="java-quote">"right"</span>/>
</p></pre></div><p class="paragraph">
</p><h3 class="heading-h2"><a name="SmallVersusLargeImages" class="anchorpoint"></a>Small Versus Large Images</h3><p class="paragraph">The normal display mode for images is to present a smaller version of the image within the body of the essay that itself is clickable. Clicking on one of these smaller images produces a popup window displaying a larger version of the image. This mechanism is automatically invoked base on the <em class="italic">filename</em> of the image declared in the <em class="italic">entity definition</em> at the top of the document. In the example above, the filename within the entity is:</p><div class="code"><pre>… SYSTEM <span class="java-quote">"http://www.thlib.org/<span class="java-keyword">static</span>/reprints/jiats/04/images/jiats04fox-img07b-sm.jpg"</span> …</pre></div><p class="paragraph">The "-sm" suffix to this file name "jiats04fox-img07b-sm.jpg" indicates that it is a smaller version and invokes the code to create the popup. For maps, charts, and so forth that should be readable within the text itself without requiring a popup, one simply does not include the "-sm" within the name of the file and uses a URL that points to a large version of the image. The markup of the image and its caption is the same as described above, but the lack of the "-sm" suffix to the file name prevents the popup from being invoked.
</p><h3 class="heading-h6"><a name="ProvidedforunrestrictedusebythespanclassnobrimgsrcsakairwikitoolimagesicklearrowgifaltexternallinktitleexternallinkahrefhttpwwwthliborgtargetrwikiexternalTibetanandHimalayanLibraryaspan" class="anchorpoint"></a><em class="italic">Provided for unrestricted use by the <span class="nobr"><img src="/" alt="external link: " title="external link"/><a href="http://www.thlib.org" target="rwikiexternal">Tibetan and Himalayan Library</a></span></em></h3>