4. Coding your document

Like HTML, XML relies on elements to code up the document. If you are familiar with coding HTML files the transition to XML should be fairly painless. OUCS XML has many elements available for use, although in any one document only a subset of these will ever be applied. In this section we discuss the elements making up the body of a text.

4.1. Sectioning your text

Your text may be just a series of paragraphs, or these paragraphs may be grouped together into chapters, sections, subsections, etc. In the former case, each paragraph is embedded inside a the <p> element. In the latter case, the <body> may be divided into a series of <div> elements, which may be further subdivided. An example of div structure is shown below:

<div>  <head>This is my heading</head>  <p> This is a paragraph</p>  <div>   <head>This is my inner section heading</head>   <p> This is a paragraph in the inner section</p>  </div> <!--This div closes the inner section--> </div> <!--This div formally closes entire section-->

Sectioning your document has important effects on the OUCS web site. Each div used is processed when the document is converted into html. Major divisions are treated as separate web pages and help to form the basis of the internal page navigation system. Each division is also sequentially numbered: 1, 2, 3 ... Where a div section is within another div, it is treated as a subsection and numbered accordingly e.g. 2.1, 2.2, 2.3....

Sectioning documents also influences the HTML output to browsers. The title of a document is always given the <h1> tag, major divisions are thus given the <h2> tag and minor section divisions are given <h3>, <h4>, <h5> etc. depending on how deep they are nested within the document.

Correct structural markup for documentation is important for accessibility. When documents are marked up in a structured way, they allow users of alternative technologies to discover the main sections and subsections more quickly and more easily. The structure allows users to jump from one section to another, without the need to read all of the information on the page. Documents that do not use structured markup pose a problem (to screen reader users in particular), as it is very difficult to find out what is on a page without reading all of the text. Where structural markup has not been used, the author has often employed styles (bold, italic, etc.) to indicate different sections and headings. While obvious to sighted readers, the structure is lost to screen reader users who must read the page to find out if it is of interest to them.

It is a requirement for authors to structure their documents in an accessible manner: relying on style alone is to be avoided as this results in inaccessible documents.

The following elements can be used to divide up your text:

<p>
marks paragraphs in prose.
<div>
contains a subdivision of the front, body, or back of a text.

When structural divisions smaller than a <div> are necessary, inner <div> elements may be used, without limit to the depth of nesting (see example above).

A div element can have the following three attributes:
type
This indicates the conventional name for this category of text division. Its value might be something like ‘Preface’.
id
This specifies a unique identifier for the division, which may be used for cross references or other links to it, such as a commentary. It is often useful to provide an id attribute for every major structural unit in a text, and to derive the id values in some systematic way, for example by appending a section number to a short code for the title of the work in question.
n
The n attribute specifies a mnemonic short name or number for the division, which can be used to identify it in preference to the id. If a conventional form of reference or abbreviation for the parts of a work already exists (such as the book/chapter/verse pattern of Biblical citations), the n attribute is the place to record it.
The attributes id and n, indeed, are so widely useful that they are allowed on any element in any TEI schema: they are global attributes.

The value of every id attribute must be unique within a document. They may be used to derive the names of HTML pages, so giving sensible mnemonic names is a good idea.

4.2. Headings and Closings

Every <div> may have a title or heading, and (less commonly) a closing such as ‘End of Chapter 1’. The following elements may be used to mark them up:
<head>
contains any heading, for example, the title of a section, or the heading of a list or glossary.
<trailer>
contains a closing title or footer appearing at the end of a division of a text.

Here is an example of their use:

<div>  <head>This is my heading</head>  <p>This is the body of the text</p>  <trailer>   <p>This is the trailer to my text</p>  </trailer> </div>

N.B. At present it is not possible to use the <head> tag without using the <div> tag first.

4.3. Marking Highlighted Phrases

4.3.1. Changes of Typeface, etc.

Highlighted words or phrases are those made visibly different from the rest of the text, typically by a change of type font, handwriting style, or ink color, intended to draw the reader's attention to them.

<hi>
marks a word or phrase as graphically distinct from the surrounding text, for reasons concerning which no claim is made.
Code view:
<hi>example</hi>
Rendered view:
example
Alternatively, where the cause for the highlighting can be identified with confidence, a number of other, more specific, elements are available. All but the first two are OUCS extensions to the standard TEI markup.
<emph>
marks words or phrases which are stressed or emphasized for linguistic or rhetorical effect
Code view:
<emph>example</emph>
Rendered view:
example
<term>
contains a single-word, multi-word or symbolic designation which is regarded as a technical term
Code view:
<term>example</term>
Rendered view:
example
<gi>
An SGML, XML or HTML element name
Code view:
<gi>h1</gi>
Rendered view:
<h1>
<Button>
A button which a user can see
Code view:
<Button>Logout</Button>
Rendered view:
Logout
<Code>
Some sort of computer language code
Code view:
<Code>\textbf{a}$^34$</Code>
Rendered view:
\textbf{a}$^34$
<Command>
The name of a command
Code view:
<Command>tcsh</Command>
Rendered view:
tcsh
<Field>
A labelled input field
Code view:
<Field>Subject</Field>
Rendered view:
Subject
<Filespec>
A file or directory specification of any kind
Code view:
<Filespec>C:\Windows\My Documents</Filespec>
Rendered view:
C:\Windows\My Documents
<Icon>
an icon in a GUI
Code view:
<Icon>Notepad</Icon>
Rendered view:
Notepad
<Input>
Text for a user to type
Code view:
<Input>quota</Input>
Rendered view:
quota
<Key>
A key to press
Code view:
<Key>R</Key>
Rendered view:
<R>
<Keyword>
A keyword in some technical code the user is being asked to write
Code view:
<Keyword>font-family</Keyword>
Rendered view:
font-family
<Label>
The label for a button, radio box, etc.
Code view:
<Label>select to activate account</Label>
Rendered view:
select to activate account
<Link>
The text of a link which is being described
Code view:
<Link>IT Information</Link>
Rendered view:
IT Information
<Menu>
A menu item
Code view:
<Menu>Save as</Menu>
Rendered view:
[Save as]
<Output>
What comes back when you give a command
Code view:
<Output>job completed</Output>
Rendered view:
job completed
<Program>
A simple program listing
Code view:
<Program>i:=0;
j:=-1;</Program>
Rendered view:
i:=0; j:=-1;
<Prompt>
A prompt from the computer
Code view:
<Prompt>password:</Prompt>
Rendered view:
password:
<Screen>
A prettified display of text screenshot
Code view:
<Screen>Thanks!
Your work is complete.</Screen>
Rendered view:
Thanks! Your work is complete.
<Software>
The name of a program
Code view:
<Software>Microsoft Word</Software>
Rendered view:
Microsoft Word
<Value>
A possible value for some option
Code view:
<Value>Times-Roman 10pt</Value>
Rendered view:
Times-Roman 10pt
If you ever really need it, the <lb/> element marks the start of a new (typographic) line.

4.4. Cross References and Links

Explicit cross references or links from one point to another in a text in the same XML document may be encoded using the elements described in section 4.4.1. Simple Cross References. References or links to elements of some other XML document, or to parts of non-XML documents, may be encoded using the TEI extended pointers described in section 4.4.2. Extended Pointers.

Accessibility of your links is important. The text you use can either enhance a user's understanding of where the link will lead, or leave them clueless. The worst phrase you can use for a link is Click Here or simply Here: in both instances the user is left with no clear idea of where the link could lead. This problem is compounded for a screen reader user: they can get lists of all links from any given page, but if the author of the page has just said Click Here or Here, they will get a list consisting of just that. The user will be left stranded on the page with no clear way to move forwards in their search for information.

An accessible link is one that conveys both where the link will go and the information the user is likely to find. By default our system will add a title attribute to any link you make on your page when it is transformed into HTML. However, while this is good practice and a nice failsafe measure, it will only add the same text as the link text. This might be adequate in some circumstances, but to make your links more accessible you should add your own additional text using the n attribute. People browsing with modern visual browsers will see your additional link information when they mouse over your link, and screen reader users will have more information about where the link will take them as the title attribute is read out to them.

4.4.1. Simple Cross References

A cross reference from one point to another within a single document can be encoded using either of the following elements:
<ref>
a reference to another location in the current document usually modified by additional text.
<ptr>
a pointer to another location in the current document.
These elements share the following attribute:
target
specifies the destination of the pointer.

The difference between these two elements is that <ptr> is an empty element, simply marking a point from which a link is to be made, whereas <ref> may contain some text as well --- typically the text of the cross-reference itself. The <ptr> element would be used for a cross reference which is indicated by a symbol or icon, or in an electronic text by a button.

The following two forms, for example, are equivalent:

See especially <ref target="SEC12">section 12 on page 34</ref>.
See especially <ptr target="SEC12"/>.
The value of the target attribute must be present in the current XML document. This implies that the passage or phrase being pointed at must bear an identifier, and must therefore be tagged as an element of some kind. In the following example, the cross reference is to a <div> element:
...see especially <ptr target="SEC12"/>.... ... <div id="SEC12">  <head>Concerning Identifiers... </head> </div>
The id attribute is global (i.e. can be used on any element), which means all elements in a document can be pointed to in this way. In the following example, a paragraph has been given an identifier so that it may be pointed at:
...this is discussed in <ref target="pspec">the paragraph on links</ref> ... <p id="pspec">Links may be made to any kind of element ...</p>

Sometimes the target of a cross reference does not correspond with any particular feature of a text, and so may not be tagged as an element of some kind. If the desired target is simply a point in the current document, the easiest way to mark it is by introducing an <anchor> element at the appropriate spot.

<ptr target="1234"/>.... .... <anchor id="1234"/>

4.4.2. Extended Pointers

The elements <ptr> and <ref> can only be used for cross-references whose targets occur within the same XML document as their source. They can also refer only to XML elements. The elements discussed in this section are not restricted in these ways.
<xptr>
defines a pointer to another location in the current document or an external document.
<xref>
defines a pointer to another location in the current document or an external document, usually modified by additional text or comment.

In addition to the attributes already discussed in section 4.4.1. Simple Cross References above, these elements share the following additional attribute, which is used to specify the target of the cross reference or link:

url
A Web URL specifying the destination

The following example shows how to link to another page and web site

See local information about <xref url="/email/clients/">email clients</xref> or go to <xptr   url="http://www.google.co.uk"   n="go to Google's web site"/>

The above example renders as follows:

See local information about email clients or go to http://www.google.co.uk

To link to a specific section on another page you should use the following syntax:

<xref url="/matlab/#fault_special">faults, problems, or special requests</xref>

4.5. Addresses

The <address> element is used to mark a postal address of any kind. It contains one or more <addrLine> elements, one for each line of the address.
address
contains a postal or other address, for example of a publisher, an organization, or an individual.
addrLine
contains one line of a postal or other address.
Here is a simple example:
<address>  <addrLine>Oxford University Computing Services</addrLine>  <addrLine>13 Banbury Rd</addrLine>  <addrLine>Oxford</addrLine>  <addrLine>OX2 6NN</addrLine> </address>

4.6. Lists

4.6.1. The various kinds of lists

The element <list> is used to mark any kind of list. A list is a sequence of text items, which may be ordered, unordered, or a glossary list. Each item may be preceded by an item label (in a glossary list, this label is the term being defined):
<list>
contains any sequence of items organized as a list. Attributes include:
type
describes the form of the list. This attribute can have the following values:
  • unordered (for lists with bullet-marked items)
  • ordered (for lists with numbered or lettered items)
  • gloss (for lists consisting of a set of technical terms, each marked with a <label> element and accompanied by a gloss or definition marked as an <item>)
If the attribute is omitted, the default is for the list to be an unordered list.
rend
describes how the labels should appear. The rend attribute can have the following values:
  • no-bullets (for producing unordered lists with no bullet points)
  • lower-alpha (for producing ordered lists with labels a, b, c, ...)
  • upper-alpha (for producing ordered lists with labels A, B, C, ...)
  • lower-roman (for producing ordered lists with labels i, ii, iii, ...)
  • upper-roman (for producing ordered lists with labels I, II, III, ...)
If the attribute is omitted, the default is to produce the labels 1, 2, 3, ... (for ordered lists) or plain bullet points (for unordered lists).
<item>
contains one component of a list.
<label>
contains the label associated with an item in a list; in glossaries, marks the term being defined.

Individual list items are tagged with <item>. The first <item> may optionally be preceded by a <head>, which gives a heading for the list. The numbering of a list may be omitted (if reconstructible), indicated using the n attribute on each item, or (rarely) tagged as content using the <label> element. In order to achieve the same result with different browsers, the value of n should be greater than 0.

4.6.2. Examples of lists

Example 1

<list>  <head>An unordered list</head>  <item>First item in list</item>  <item>Second item in list</item>  <item>Third item in list</item> </list>

An unordered list

  • First item in list
  • Second item in list
  • Third item in list

Example 2

<list type="ordered">  <head>An ordered list</head>  <item>First item in list</item>  <item>Second item in list</item>  <item>Third item in list</item> </list>

An ordered list

  1. First item in list
  2. Second item in list
  3. Third item in list

Example 3

<list type="ordered">  <head>An ordered list with controlled numbering </head>  <item n="3">First item in list</item>  <item>Second item in list</item>  <item>Third item in list</item> </list>

An ordered list with controlled numbering

  1. First item in list
  2. Second item in list
  3. Third item in list

Example 4

<list type="orderedrend="lower-alpha">  <head>An ordered list with letters for labels</head>  <item>First item in list</item>  <item>Second item in list</item>  <item>Third item in list</item> </list>

An ordered list with letters for labels

  1. First item in list
  2. Second item in list
  3. Third item in list

Example 5

<list type="orderedrend="lower-alpha">  <head>An ordered list with controlled lettering </head>  <item n="9">First item in list</item>  <item>Second item in list</item>  <item>Third item in list</item> </list>

An ordered list with controlled lettering

  1. First item in list
  2. Second item in list
  3. Third item in list

Example 6

<list type="gloss">  <head>A glossary list</head>  <label>One</label>  <item>First item in list</item>  <label>Two</label>  <item>Second item in list</item>  <label>Three</label>  <item>Third item in list</item> </list>

A glossary list

One
First item in list
Two
Second item in list
Three
Third item in list

The styles should not be mixed in the same list.

Example 7

A simple two-column table may be treated as a glossary list, tagged <list type=gloss>. Here, each item comprises a term and a gloss, marked with <label> and <item> respectively.

<list type="gloss">  <head>Vocabulary</head>  <label>nu</label>  <item>now</item>  <label>lhude</label>  <item>loudly</item>  <label>bloweth</label>  <item>blooms</item>  <label>med</label>  <item>meadow</item>  <label>wude</label>  <item>wood</item>  <label>awe</label>  <item>ewe</item>  <label>lhouth</label>  <item>lows</item>  <label>sterteth</label>  <item>bounds, frisks</item>  <label>verteth</label>  <item lang="lat">pedit</item>  <label>murie</label>  <item>merrily</item>  <label>swik</label>  <item>cease</item>  <label>naver</label>  <item>never</item> </list>

The above is rendered as follows:

Vocabulary

nu
now
lhude
loudly
bloweth
blooms
med
meadow
wude
wood
awe
ewe
lhouth
lows
sterteth
bounds, frisks
verteth
pedit
murie
merrily
swik
cease
naver
never

4.6.3. Nested lists

Lists of whatever kind can, of course, nest within list items to any depth required. Here, for example, a glossary list contains two items, each of which is itself a simple list:

<list type="gloss">  <label>EVIL</label>  <item>   <list type="simple">    <item>I am cast upon a horrible desolate island, void of all hope of        recovery.</item>    <item>I am singled out and separated as it were from all the world to be        miserable.</item>    <item>I am divided from mankind &amp;#8212; a solitaire; one banished from        human society.</item>   </list> <!-- end of first nested list -->  </item>  <label>GOOD</label>  <item>   <list type="simple">    <item>But I am alive; and not drowned, as all my ship's company were.</item>    <item>But I am singled out, too, from all the ship's crew, to be spared from        death...</item>    <item>But I am not starved, and perishing on a barren place, affording no        sustenances....</item>   </list> <!-- end of second nested list -->  </item> </list> <!-- end of glossary list -->

The above is rendered as follows:

EVIL
  • I am cast upon a horrible desolate island, void of all hope of recovery.
  • I am singled out and separated as it were from all the world to be miserable.
  • I am divided from mankind - a solitaire; one banished from human society.
GOOD
  • But I am alive; and not drowned, as all my ship's company were.
  • But I am singled out, too, from all the ship's crew, to be spared from death...
  • But I am not starved, and perishing on a barren place, affording no sustenances....

4.7. Tables

The following elements are provided for describing tables:
<table>
contains text displayed in tabular form, in rows and columns.
<row>
contains one row of a table. Attributes include:
role
indicates the kind of information held in the cells of this row. This attribute should have the value label for labels or descriptive information, and data for actual data values. If omitted, it defaults to data.
<cell>
contains one cell of a table. Attributes include:
role
indicates the kind of information held in the cell. This attribute should have the value label for labels or descriptive information, and data for actual data values. If omitted, it defaults to data.
cols
indicates the number of columns occupied by this cell. If omitted, it defaults to 1.
rows
indicates the number of rows occupied by this cell. If omitted, it defaults to 1.

The <table> element can also take the align, summary, width, border, frame, rules, cellspacing and cellpadding attributes defined in HTML, and the conversion to HTML will pass them straight through.

4.7.1. Making your table accessible

Caution is advised when using tables as it is very easy to make them inaccessible to users of alternative technologies e.g. screen readers. It is your responsibility to make sure that any table used is comprehensible when it is linearised and that it contains suitable accessibility attributes.

Screen readers linearise tables when they are reading the content out to the user. This means that if you have failed to take this into account when designing your table, the screen reader user will not understand the content of your table. To check to see how your table will be read out, go to http://wave.webaim.org/. Run your page containing the table through this online checker. It will show you how the table will be read to a screen reader user.

All tables should be given the summary attribute regardless of whether they are for data or page layout. For data tables a short summary of the table content must be added for accessibility. Where a table is used for layout, the summary attribute is included, but left empty.

Here is an example:

<table>  <head>table shows the rise and fall of mortality figures during the plague</head>  <row role="label">   <cell/>   <cell cols="3">years</cell>  </row>  <row role="label">   <cell/>   <cell>1</cell>   <cell>2</cell>   <cell>3</cell>  </row>  <row>   <cell role="label">St. Leonard's, Shoreditch</cell>   <cell>64</cell>   <cell>84</cell>   <cell>119</cell>  </row>  <row>   <cell role="label">St. Botolph's, Bishopsgate</cell>   <cell>65</cell>   <cell>105</cell>   <cell>116</cell>  </row>  <row>   <cell role="label">St. Giles's, Cripplegate</cell>   <cell>213</cell>   <cell>421</cell>   <cell>554</cell>  </row> </table>

The above is rendered as:

Table 1. table shows the rise and fall of mortality figures during the plague
years
123
St. Leonard's, Shoreditch 64 84 119
St. Botolph's, Bishopsgate 65 105 116
St. Giles's, Cripplegate 213 421 554

4.7.2. Making your table sortable

4.7.2.1. Normal use

If a <table> element has a rend attribute with the value tablesorter, the table will be rendered with the cells of the first column sorted and with buttons on each column that enable the person viewing the page to sort the table on another column.

<table rend="tablesorter"> ... </table>

Here is an example of what can be done:

Table 2. table shows a use of the tablesorter rend (derived from an example at http://tablesorter.com/docs/)
First Name   Last Name   Age   Total   Discount   Difference   Date and timeISOUK 1UK 2
Peter Parker 28 £9.99 20.9% +12.1 Sep 9, 2002 8:14 AM 2002-09-09 09-09-2002 09/09/2002
John Good 33 £19.99 125% +12 Jan 12, 2003 5:14 AM 2003-01-12 12-01-2003 12/01/2003
Clark Kent 18 £15.89 44% -26 Jan 18, 2001 11:14 AM 2001-01-18 18-01-2001 18/01/2001
Bruce Almighty 45 £153.19 44.7% +77 Sep 10, 2002 9:12 AM 2002-09-10 10-09-2002 10/09/2002
Bruce Evans 22 £13.19 11% -100.9 Sep 1, 2002 9:12 AM 2002-09-01 01-09-2002 01/09/2002

The above can be achieved using the following TEI:

<table rend="tablesorter">  <head>table shows a user of the tablesorter rend (derived from an example at http://tablesorter.com/docs/)</head>  <row role="label">   <cell>First Name&amp;#160;&amp;#160;&amp;#160;</cell>   <cell>Last Name&amp;#160;&amp;#160;&amp;#160;</cell>   <cell>Age&amp;#160;&amp;#160;&amp;#160;</cell>   <cell>Total&amp;#160;&amp;#160;&amp;#160;</cell>   <cell>Discount&amp;#160;&amp;#160;&amp;#160;</cell>   <cell>Difference&amp;#160;&amp;#160;&amp;#160;</cell>   <cell>Date and time</cell>   <cell>ISO</cell>   <cell>UK 1</cell>   <cell>UK 2</cell>  </row>  <row>   <cell>Peter</cell>   <cell>Parker</cell>   <cell>28</cell>   <cell>£9.99</cell>   <cell>20.9%</cell>   <cell>+12.1</cell>   <cell>Sep 9, 2002 8:14 AM</cell>   <cell>2002-09-09</cell>   <cell>09-09-2002</cell>   <cell>09/09/2002</cell>  </row>  <row>   <cell>John</cell>   <cell>Good</cell>   <cell>33</cell>   <cell>£19.99</cell>   <cell>125%</cell>   <cell>+12</cell>   <cell>Jan 12, 2003 5:14 AM</cell>   <cell>2003-01-12</cell>   <cell>12-01-2003</cell>   <cell>12/01/2003</cell>  </row>  <row>   <cell>Clark</cell>   <cell>Kent</cell>   <cell>18</cell>   <cell>£15.89</cell>   <cell>44%</cell>   <cell>-26</cell>   <cell>Jan 18, 2001 11:14 AM</cell>   <cell>2001-01-18</cell>   <cell>18-01-2001</cell>   <cell>18/01/2001</cell>  </row>  <row>   <cell>Bruce</cell>   <cell>Almighty</cell>   <cell>45</cell>   <cell>£153.19</cell>   <cell>44.7%</cell>   <cell>+77</cell>   <cell>Sep 10, 2002 9:12 AM</cell>   <cell>2002-09-10</cell>   <cell>10-09-2002</cell>   <cell>10/09/2002</cell>  </row>  <row>   <cell>Bruce</cell>   <cell>Evans</cell>   <cell>22</cell>   <cell>£13.19</cell>   <cell>11%</cell>   <cell>-100.9</cell>   <cell>Sep 1, 2002 9:12 AM</cell>   <cell>2002-09-01</cell>   <cell>01-09-2002</cell>   <cell>01/09/2002</cell>  </row> </table>
4.7.2.2. Customising tablesorter

There are two ways in which the use of tablesorter can be customised. You will also find the documentation for tablesorter useful.

4.7.2.2.1. Customising tablesorter: for specific tables

This is appropriate if you want to do your own customisation of tablesorter for specific tables that occur in a TEI file.

In the teiHeader of the TEI file, you provide JavaScript like the following:

<html:script type="text/javascript"> var someOtherTextExtraction = function(node) { var anchortext = node.innerHTML.indexOf("--anchor--"); if ( anchortext == -1 ) { return node.innerHTML; } else { return node.innerHTML.substring(anchortext + 15); } } $(document).ready(function() { $table = $(".tablesorternoinitcode").tablesorter( {dateFormat: 'uk', sortList: [[0,0]], textExtraction: someOtherTextExtraction} ); } ); </html:script>

And you alter the table to have the following rends:

<table rend="tablesorter tablesorternoinitcode"> ... </table>

Gotcha: if you do provide a <html:script> element, remember to define the html namespace. For more details, see the section of this document labelled Using HTML elements in a TEI file.

The above assumes you want to do the same initialisation code for each table. If you want different initialisation code for some of the tables, add another value to the rend attribute of each table:

<table   rend="tablesorter tablesorternoinitcode tableone"> ... </table>

and refer to this value (rather than tablesorternoinitcode) in the initialisation code:

$table = $(".tableone").tablesorter(

The tablesorternoinitcode must still be present in the rend. It is being used to indicate that you do not want the XSL to generate the default initialisation code.

4.7.2.2.2. Customising tablesorter: for all tables of a site

This is appropriate if you want a micro site to have full control of the customisation of tablesorter.

The file oucsstandard.xsl has the following definition for the template outputTableSorterInitCode. In the XSL for the micro site, you define a template that overrides this.

<xsl:template name="outputTableSorterInitCode"> <script type="text/javascript"> var GTSTextExtraction = function(node) { var anchortext = node.innerHTML.indexOf("--anchor--"); if ( anchortext == -1 ) { return node.innerHTML; } else { return node.innerHTML.substring(anchortext + 15); } } $(document).ready(function() { $table = $(".tablesorter:not(.tablesorternoinitcode)").tablesorter( {dateFormat: 'uk', sortList: [[0,0]], textExtraction: GTSTextExtraction} ); } ); </script> <xsl:call-template name="outputLinebreak"/> </xsl:template>

4.8. Figures and Graphics

Not all the components of a document are necessarily textual. The most straight forward text will often contain diagrams or illustrations, to say nothing of documents in which image and text are inextricably intertwined, or electronic resources in which the two are complementary. This poses accessibility issues for users who cannot see the images. What are they? Are they important to the text, or just page decoration? Is the image a graph or simple picture? Has the author provided extra information about the graphic for those that cannot see it? If you do not provide alternative text for graphics or other accessibiity features in the page coding, the page will be inaccessible to some visitors.

The following tags and attributes are used to add images to web pages:

<figure>
marks the spot at which a graphic is to be inserted in a document. Attributes include:
url
The location and file name of a graphic.
width
The width to which the graphic should be scaled. If omitted, it defaults to the width of the graphic.
height
The height to which the graphic should be scaled. If omitted, it defaults to the height of the graphic.
scale
The extent which the graphic should be scaled (eg 0.5). If omitted, it defaults to 1.
<figDesc>
contains a textual description of the appearance or content of a graphic, essential for accessible graphics.

A picture is inserted into a document using the url attribute of the <figure> element:

<figure url="fezziPic.png">  <head>Mr Fezziwig's Ball</head>  <figDesc>A Cruikshank engraving showing Mr Fezziwig leading a group of    revellers.</figDesc> </figure>

Usually, a graphic will have at the least an identifying title, which should be encoded using the <head> element. Images which are given a head tag have this text automatically converted to a figure caption and are numbered sequentially throughout the document. It is also essential to include a brief description of the image using <figDesc>. If the image is difficult to describe in just a few words, you should provide an alternative page where a full account of the image can be given to the user: this extra information should be provided via a [d] link. These are normal url links to normal web pages. By convention the [d] link should be provided next to the image in question; users needing greater detail about a given image will click on the [d] link for more information.

If the image is for decoration only (very rare on OUCS pages), it is still necessary to include the <figDesc> element in your document, but in this case it should be left blank. By convention the image is then considered just page decoration and unimportant to the reader.

If you want to control the way text flows around an image, use a rend value, as described in the Rends section.

4.9. Getting a TEI file to display a newsfeed

A newsfeed can be displayed by putting a <xptr> element with a rend of rss and a type of transclude inside a <p> element. The url attribute has the URL of the newsfeed. Our XSL can cope with newsfeeds written in RSS 2.0, RSS 1.0 and Atom 1.0.

<p> <xptr rend="rss" type="transclude" url="http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml" /> </p>

This will produce output like the following:

Israel and Hamas agree new truceIsrael and Hamas agree to an unconditional 72-hour humanitarian ceasefire to begin on Friday morning, after 24 days of fighting between the two sides.
Therapies hope for major DNA projectA project aiming to revolutionise medicine by unlocking the secrets of DNA is under way in centres across England.
Multiple Taiwan gas blasts kill 22A series of gas explosions in the southern Taiwanese city of Kaohsiung kills at least 22 people and injures more than 200 others.
Whistle-blowers often victimised - MPsThe treatment of employees in public services who raise concerns about wrongdoing is often "shocking", a group of MPs says.
Exam body to check 'extra help' dataThe exams regulator Ofqual is to collect information on how many private school students receive extra time in exams, compared with state pupils.
Man arrested in Syria terror inquiryA 23-year-old man is arrested in west London - and later bailed - on suspicion of raising money for terrorism in Syria.
Three Britons die in Croatia crashThree Britons, including two children, were killed after their car was involved in a crash with a truck in Croatia, local police say.
WHO sounds alarm over W Africa EbolaThe World Health Organization and presidents of West African nations affected by the Ebola outbreak are to announce a joint $100m response plan.
'Draconian' Russian net law enactedA new law imposing restrictions on bloggers and social media users has come into effect in Russia.
Technique turns bodies 'see-through'A newly discovered way to make entire bodies transparent could pave the way for a new generation of treatments, scientists say.

By default, 10 items of the feed will get output together with an RSS icon that allows people to subscribe to the newsfeed.

Gotcha: the web page will not change when new items get added to the feed unless you arrange for your page not to be cached by AxKit. Please contact webmaster@oucs.ox.ac.uk to get this done.

4.9.1. rsssummary gives a different style of output

Other components can be added to the rend to control what gets output and how it gets output.

A different style of output is delivered if you add rsssummary to the rend:

<p> <xptr rend="rss rsssummary" type="transclude" url="http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml" /> </p>

This will produce output like the following:

Israel and Hamas agree new truceIsrael and Hamas agree to an unconditional 72-hour humanitarian ceasefire to begin on Friday morning, after 24 days of fighting between the two sides.
Therapies hope for major DNA projectA project aiming to revolutionise medicine by unlocking the secrets of DNA is under way in centres across England.
Multiple Taiwan gas blasts kill 22A series of gas explosions in the southern Taiwanese city of Kaohsiung kills at least 22 people and injures more than 200 others.
Whistle-blowers often victimised - MPsThe treatment of employees in public services who raise concerns about wrongdoing is often "shocking", a group of MPs says.
Exam body to check 'extra help' dataThe exams regulator Ofqual is to collect information on how many private school students receive extra time in exams, compared with state pupils.
Man arrested in Syria terror inquiryA 23-year-old man is arrested in west London - and later bailed - on suspicion of raising money for terrorism in Syria.
Three Britons die in Croatia crashThree Britons, including two children, were killed after their car was involved in a crash with a truck in Croatia, local police say.
WHO sounds alarm over W Africa EbolaThe World Health Organization and presidents of West African nations affected by the Ebola outbreak are to announce a joint $100m response plan.
'Draconian' Russian net law enactedA new law imposing restrictions on bloggers and social media users has come into effect in Russia.
Technique turns bodies 'see-through'A newly discovered way to make entire bodies transparent could pave the way for a new generation of treatments, scientists say.

4.9.2. rsslimit-all outputs all items and rssnoimage omits the RSS icon

Suppose you want all the items of the feed to be output but you do not want the RSS icon:

<p> <xptr rend="rss rssnoimage rsslimit-all" type="transclude" url="http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml" /> </p>

This will produce output like the following:

Israel and Hamas agree new truceIsrael and Hamas agree to an unconditional 72-hour humanitarian ceasefire to begin on Friday morning, after 24 days of fighting between the two sides.
Therapies hope for major DNA projectA project aiming to revolutionise medicine by unlocking the secrets of DNA is under way in centres across England.
Multiple Taiwan gas blasts kill 22A series of gas explosions in the southern Taiwanese city of Kaohsiung kills at least 22 people and injures more than 200 others.
Whistle-blowers often victimised - MPsThe treatment of employees in public services who raise concerns about wrongdoing is often "shocking", a group of MPs says.
Exam body to check 'extra help' dataThe exams regulator Ofqual is to collect information on how many private school students receive extra time in exams, compared with state pupils.
Man arrested in Syria terror inquiryA 23-year-old man is arrested in west London - and later bailed - on suspicion of raising money for terrorism in Syria.
Three Britons die in Croatia crashThree Britons, including two children, were killed after their car was involved in a crash with a truck in Croatia, local police say.
WHO sounds alarm over W Africa EbolaThe World Health Organization and presidents of West African nations affected by the Ebola outbreak are to announce a joint $100m response plan.
'Draconian' Russian net law enactedA new law imposing restrictions on bloggers and social media users has come into effect in Russia.
Technique turns bodies 'see-through'A newly discovered way to make entire bodies transparent could pave the way for a new generation of treatments, scientists say.
Appeal over CBBC actor's killingPolice hunting for a man wanted over the stabbing of a children's TV actor offer a £10,000 reward for information leading to his arrest and prosecution.
Switching broadband is 'too costly'Tens of thousands of broadband customers in the UK are having to pay "costly" charges to change supplier, Citizens Advice warns
'Genetic revolution' on front pagesThe announcement of £300m in funding for a plan to map DNA profiles in a bid to fight health problems such as cancer features in several papers.
Edinburgh Festival Fringe beginsThousands of performers from across the world are in Edinburgh for the start of the world's biggest arts festival.
Sassoon war diaries published onlineTwenty-three journals belonging to the war poet Siegfried Sassoon, many written in the trenches, are being published online for the first time.
Hat-trick of golds for England gymnastsEngland gymnasts Max Whitlock and Claudia Fragapane win their third gold medals of the Commonwealth Games with individual wins.
Weir powers to Commonwealth goldEngland's David Weir puts in a majestic display to win his first Commonwealth Games title in the men's T54 1500m.
Home favourite Child wins silver medalCommonwealth Games poster girl Eilidh Child wins silver in the women's 400m hurdles at Hampden Park.
Cook relieved by England victoryCaptain Alastair Cook is pleased that England's win in the third Test against India has ended a bad run of form.
The inside story of the great Southampton sell-offBroken pacts, discontent and a silent owner - sports reporter Ben Smith on the background to Saints' £92m player sale.
VIDEO: Are Rudolf Steiner's ideas working?Newsnight has learned that complaints were made to the Department for Education about some privately funded Steiner schools.
VIDEO: Last of the scissor makersEric Stones has been making scissors by hand for 58 years.
VIDEO: Immersive cinema: Is this the future?Newsnight reports on the growing popularity of immersive entertainment.
VIDEO: Mysterious miracle? Crop circle draws crowdsA giant crop circle which apparently appeared out of nowhere, has drawn crowds of people to a farmer's field in Bavaria, southern Germany.
VIDEO: What was in WW1 British soldier's kit?Military historian Andy Robertshaw talks through the uniform worn by soldiers in the British Expeditionary Force at the start of World War One.
VIDEO: Underwater art exhibition in ItalyAn exhibition of photographs is taking place underwater off an Italian island.
VIDEO: More handlers to tackle Gatwick bagsGatwick Airport is bringing in extra staff of its own to handle baggage following chaotic scenes last weekend, when passengers were left waiting for up to three hours for luggage.
VIDEO: Is your big tummy a diabetes warning ?Health officials in England are urging people to measure and monitor their waistlines, to help avoid type 2 diabetes.
WTO fails to seal global trade dealThe World Trade Organization says its 160 members have failed to agree a global customs pact drawn up in meetings in Bali last December.
VIDEO: Indonesia's new rich spend it bigWealth and growing inequality in Indonesian capital Jakarta
Tory disquiet over Israel actionConservative MPs put pressure on David Cameron to take a more robust stance with Israel over its actions in Gaza.
VIDEO: Tory MP: World won't tolerate deathsThe Israeli bombardment of Gaza "is wrong" and has "no justification in terms of results", a Tory MP has said.
Minister wants end to animal testingNorman Baker - the minister in charge of regulating animal experiments - tells the BBC he wants them to end.
VIDEO: Sun bracelet measures UV exposureThe BBC's Dougal Shaw tests out a digital bracelet designed to help people avoid getting too much sun exposure.
Assaults on teachers top 90 a dayThere were over 90 assaults on teachers by pupils in England each school day last year, official figures show.
Israeli Iron Dome firms 'hacked'The BBC has seen evidence that appears to confirm hackers stole secret military documents from two Israeli government-owned companies.
VIDEO: Broads-view opens up Norfolk waterwaysThe Norfolk Broads will soon be available for virtual navigation thanks to a novel aquatic equivalent of Google's Streetview technology
Goalkeepers' penalty 'flaw' revealedGoalkeepers in penalty shoot-outs make a predictable error that could influence the outcome of the game according to new research.
AUDIO: Why the Moon is shaped like a lemonProfessor of planetary sciences Ian Garrick-Bethell explains what gave the Moon its unusually distorted shape.
Met Opera in late union talksThe Metropolitan Opera in New York says it hopes last minute negotiations with unions over a pay dispute will avoid a staff lockout.
Quiz of the week's newsThe Magazine's weekly quiz of the news, 7 days 7 questions.
How do you get your face on the dollar?The US is debating putting a woman's face on the US dollar. How does it happen?
Power station fire damages towerA large fire breaks out at Ferrybridge C power station in West Yorkshire, causing the partial collapse of a tower.
Aircraft crashes at Royal Navy eventAn aircraft crashes on to the runway at the Royal Navy Culdrose Air Day in Cornwall.
Child savours Games silver medalScottish hurdler Eilidh Child says winning silver at Glasgow 2014 is "one of the best moments" of her career.
New school closure rules take effectNew rules on school closures designed to ensure greater transparency and accurate information come into force across Scotland.
Executive backs £78m cuts to budgetStormont departments, excluding health and education, are to have their budgets cut by £78m as the executive agrees to endorse the June monitoring round.
Woman left children alone for daysA woman living in Belfast who abandoned her three children at home overnight with no food is given a suspended six-month jail sentence.
Man jailed after door banging deathA hammer-wielding drug addict is jailed after a woman suffered a heart attack and died when she was terrorised in her own home.
400 jobs saved in oil refinery saleA sale is agreed on the closure-threatened Murco oil refinery in Milford Haven, safeguarding 400 jobs.
Sudan 'apostasy' woman arrives in USA Sudanese woman who fled to Italy after being spared a death sentence for renouncing Islam has arrived in the US.
Giraffe dies after 'hitting bridge'South Africa's animal rights body is probing the death of a giraffe that reportedly hit its head on a bridge as it was being transported on a motorway.
Race to find India landslide missingRescuers in western India race to locate survivors of a landslide that has killed at least 30 and buried up to 200 people, but hopes of finding survivors fade as time passes.
Xinjiang imam killed after clashesThe imam of China's largest mosque - in the city of Kashgar in Xinjiang - has been killed, in what appears to be a targeted assassination.
Forensic scientists reach MH17 siteInternational forensic scientists reach the site of the flight MH17 crash in east Ukraine after the government halts military operations for a day.
Nato 'unprepared for Russia threat'Nato is poorly prepared for an attack on a member state by Russia, a group of MPs warns in a report.
Argentina blames US for debt defaultArgentina blames the US for its default, calling the mediator in debt negotiations which ended in failure "incompetent".
Mexico migrants' train deal reachedThe US, Mexico and Guatemala will establish more checkpoints along the route of a freight train to prevent migrants from boarding it, Guatemala says.
Filipinos urged to leave LibyaA top diplomat from the Philippines is to oversee the evacuation of 13,000 citizens from Libya after a Filipino worker was beheaded and a nurse raped.
Turkey PM to return US Jewish awardA row over Israel prompts Turkey's PM Erdogan to return an award he received in 2004 from the American Jewish Congress.
Memo reveals response to CIA 'abuse'A still-secret Senate report on CIA enhanced interrogations "tells a story of which no American is proud", a leaked White House memo states.
US ex-governor's wife 'sought gifts'The star witness in the corruption trial of Virginia ex-governor Bob McDonnell says the ex-first lady sought gifts in return for business help.
Week in pictures: 19-25 July 2014News photos from around the world
A community's talesSound-portraits of the residents of Carrick-on-Suir
Day in pictures: 25 July 201424 hours of news photos: 25 July
'Hidden' photos reveal library build'Hidden' images reveal Cambridge's University Library
Your pictures: CyclingReaders' photos on the theme of "cycling"
Dream Cars: Innovative Design, Visionary IdeasConcept designs by famous manufacturers on show in US
Taiwan plane crash: In picturesTransAsia Airways plane crashes in Taiwan
Prince George's first yearPrince George's first year
VIDEO: House of CommonsIsrael's response to rocket attacks must be "proportionate", insists a minister.
VIDEO: Who are the children fleeing to the US border?New data from the Pew Research center shows that children 12 and under are coming to the US in droves
VIDEO: Rare contact with remote Amazon tribeA group of previously isolated indigenous people from the Amazon has come face to face with a settled community of villagers for the first time in the Brazilian state of Acre, according to authorities.
VIDEO: Footage captures power station fireA fire has broken out at Ferrybridge power station, near Castleford.
VIDEO: Fighting hampers MH17 investigationHeavy fighting between Ukrainian forces and pro-Russia rebels around Donetsk has prevented international experts from reaching the MH17 plane crash site.
VIDEO: The rise and rise of video blogsMembers of the 'millennial generation' are finding ways to earn a living from skills they learned not at school, but on social media.
VIDEO: Gaza families 'can't outrun this war'The BBC's Martin Patience reports from Gaza, where Palestinians continue to seek shelter in a UN-run school despite a shelling which killed 16 people.
VIDEO: Daylight reveals gutted Eastbourne pierFire crews have saved two thirds of Eastbourne Pier after fire destroyed part of the structure, leaving a metal skeleton.
VIDEO: Axe crashes through windscreenA car passenger had a lucky escape after an axe flew off the back of a lorry and through the windscreen of the vehicle travelling behind it.
World War One battlefields 100 years onWorld War One battlefields, 100 years on
Is it ever acceptable to wear sunglasses indoors?Is it ever acceptable to wear sunglasses indoors?
Broods: New Zealand's next pop exportMeet New Zealand's next big musical exports
Turning Berlin into a work of artHow an artist created a vast verbal map of Berlin
Keeping the cyber thieves at bayKeeping cyber thieves' paws off your data
Bling for Indonesia's new mega-richWealth and growing inequality in Indonesian capital Jakarta
VIDEO: Commonwealth Games goes virtualCommonwealth Games streamed live to a virtual reality headset.
Learning disabled care campaignWhere should people with learning disabilitieslive?
Ukraine crisis creates UK tensionsUkraine crisis creating high-level UK tensions, Mark Urban writes
The very public NHS privatisation debateIs privatisation of the NHS in England on the agenda?

4.9.3. rsslimit-2 outputs two items and rssbrief just outputs the titles

Suppose you just want the titles and you only want two items output:

<p> <xptr rend="rss rssbrief rsslimit-2" type="transclude" url="http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml" /> </p>

This will produce output like the following:

Israel and Hamas agree new truce
Therapies hope for major DNA project

4.9.4. jsdate-XXXX outputs the date the item was published

If you also want the date when the item was published, you can use:

<p> <xptr rend="jsdate-[d_F_Y] rss rssbrief rsslimit-2" type="transclude" url="http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml" /> </p>

Here the rend attribute has a component that starts with jsdate-. This is followed by some notation (e.g., [d_F_Y]) that indicates how you want the date formatted. It uses the same notation that is used by PHP for its date function with the addition of one character: a _ means generate a space.

The date is output in a <span> that has a class of rssdate and the default CSS hides any such span. So you will also need to define some CSS to ensure the date is displayed:

<html:style type="text/css"> .rssdate { display: inline; padding-left: 10px; } </html:style>

This will produce output like the following:

Israel and Hamas agree new truce
Therapies hope for major DNA project

Here's another example. The TEI elements:

<p> <xptr rend="jsdate-l,_F_jS,_Y rss rssnoimage rsslimit-2" type="transclude" url="http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml" /> </p>

will produce output like the following:

Israel and Hamas agree new truceIsrael and Hamas agree to an unconditional 72-hour humanitarian ceasefire to begin on Friday morning, after 24 days of fighting between the two sides.
Therapies hope for major DNA projectA project aiming to revolutionise medicine by unlocking the secrets of DNA is under way in centres across England.

4.10. Using HTML elements in a TEI file

Although TEI is a rich language so that most of what can be coded in HTML can also be coded in TEI, there are occasions when you may want to use some HTML in a TEI document.

If you wish to do this, you need to introduce a namespace that you can use to say that a particular element belongs to HTML rather than to TEI. Usually, the name html is used for this namespace.

Somewhere you have to indicate which name you are using. Usually, this is done by replacing the first line of the file:
<TEI.2>
by:
<TEI.2 xmlns:html="http://www.w3.org/1999/xhtml">
You can then use an HTML element (e.g., the <style> element) by prefixing its name with the namespace html:
<html:style type="text/css"> .overdue: { background-color: red; } </html:style>
Here is another example:
<html:script type="text/javascript"> var GCS_due_date = ""; ... </html:script>

If you want some HTML elements to appear in the <head> element of the HTML that gets generated, you should put these elements between the <fileDesc> and the <revisionDesc> elements (that appear in the <teiHeader>).

Suppose you do wish to add an HTML <style> element. The rules of HTML say the <style> element must finish up in the <head> element of the resulting HTML. So to achieve this, use something like:
... </fileDesc> <html:style type="text/css"> .overdue: { background-color: red; } </html:style> <revisionDesc> ...

4.11. Forms to collect data and send a message

It is possible to provide a form (in a TEI file) that collects some data from a user and sends that data to someone in an e-mail message. There are details about this in a document on FormMail.

4.12. Accessibility of documentation

Accessibility of our documentation is paramount to ensure documents are accessible to all readers and for OUCS to stay on the correct side of the law. It is necessary for all OUCS authors to familiarise themselves with the ways and means to make their documents as accessible as possible.

Authors need to make sure that they follow the following guidelines:

  • do not make links with the text here or click here, make links that mean something out of context of the sentence they are in. Similarly do not use the same titles for lots of different links on a page when they actually point to different places.
  • When using graphics always provide the <figDesc> element. If necessary go the extra step and make a [d] link for longer explanations of figures
  • When using tables, make sure they are comprehensible when they are linearised. Always include the summary attribute regardless of whether the table is for layout or data. The latter requires you to give some details of the table's content.
  • When you have finished making a web page, you can check its accessibility using online services such as those found in the Complete List of Web Accessibility Evaluation Tools (compiled by the Web Accessibility Initiative (WAI)).

Please use these checkers and make any changes required.

Up: Contents Previous: 3. Getting Started - The Basics Next: 5. Specialised Features