All elements in the source are in the DHQ namespace,
http://digitalhumanities.org/DHQ/namespace
, except as noted
below (Creative Commons and RDF namespaces appearing in the header). In
this map, no namespace prefix is used for DHQ elements (as is commonly the
case in source documents); the stylesheet should use the
dhq
prefix for clarity (allowing the results to be in no namespace).
In the result, no MathML will appear, but the XLink namespace,
http://www.w3.org/1999/xlink/
, may occasionally be used. It
can be declared at the top level to avoid repeating its declarations. The
target format, NLM/NCBI, keeps its own elements in no namespace.
DHQarticle becomes article. All articles will have at least article/front and article/body; article/back and article/floats will be created in some cases as described below.
Metadata for the target format is all derived from the DHQheader element in the source. In all cases there will be front/journal-meta and front/article-meta elements, in that order, in the result.
Additionally, if there is a DHQheader/history/sourceDesc or DHQheader/history/revisionDesc, a front/notes element is created.
Inside journal-meta, create the following, in this order:
journal-title containing "Digital Humanities Quarterly".
abbrev-journal-title containing "DHQ".
issn containing "1938-4122".
publisher containing publisher-name, which contains "The Alliance of Digital Humanities Organizations".
Inside article-meta, create the following, in this order:
An article-id containing the value of DHQheader/publicationStmt/idno[@type='DHQarticle-id']. Assign a @pub-id-type of "DHQarticle-id" to the article-id.
An article-categories containing a series-title with the value of DHQheader/publicationStmt/articleType. (It will be one of 'article', 'review', 'editorial' or 'opinion'.)
title-group, containing
article-title for DHQheader/title.
subtitle for DHQheader/subtitle, if present.
contrib-group, containing
contrib for each DHQheader/author in the source, each containing
name for author/name, containing
surname for any name/family element, or the entire contents of name when there is no family element, and
firstname for any non-whitespace text contents of name, concatenated together in document order, when there is a name/family element.
Note that this is not a foolproof casting for name; to do better, upconversion is required.
aff for any affiliation.
address for any address, in which each addrLine becomes address-line.
email for any email.
bio for any bio, whose (paragraph) contents are mapped as elsewhere.
pub-date from DHQheader/publicationStmt/date. The contents are constructed as follows from the date/@when attribute, which is given in ISO date format ('YYYY-MM-DD'):
If possible, cast the value to an XSD date object. If it does not cast, throw an error.
Create a day for the 'day' value, if present.
Create a month for the 'month' value.
Create a year for the 'year' value.
volume from DHQheader/publicationStmt/idno[@type='volume']
issue from DHQheader/publicationStmt/idno[@type='issue']
issue-title from DHQheader/publicationStmt/issueTitle.
Next, any bibl appearing anywhere inside the /DHQarticle/text with @type='reviewTarget' (that is, at any depth) becomes product. Its contents are handled the same as they are when bibl is used for citations (mapped below).
history from DHQheader/history/submission when the submission has a @date, with history/date with @date-type of "submission". The contents of the history/date should be generated from the value of the submission/@date in the same way as pub-date is generated from DHQheader/publicationStmt/date/@when (see above).
Contents of DHQheader/history/submission, however, are dropped.
permissions from DHQheader/publicationStmt/availabilty, as follows:
If availability contains item, the item becomes one or more p inside a permissions/license. Create a single p if the item contains text content; if it contains p contents, map each p to a p in the result.
If availability does not contain item, it will contain something like this:
<License xmlns="http://web.resource.org/cc/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="http://creativecommons.org/licenses/by-nc-nd/2.5/"/>In other words, License in the Creative Commons (
http://web.resource.org/cc/
namespace. Attached to
License
will be an
@about
in an RDF (http://www.w3.org/1999/02/22-rdf-syntax-ns#
)
namespace.
Generate a permissions/license element with @license-type with this value:
Creative Commons XXXwhere 'XXX' is the substring of @about after "http://creativecommons.org/licenses/" (in this case, "by-nc-nd/2.5"), and @xlink:href the (entire) value of @about.
If (but only if) the value of @about is the literal string "http://creativecommons.org/licenses/by-nc-nd/2.5/", inside license, create a p containing the text:
Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 Generic
If @about has any other value, leave license empty and generate a warning.
Ordinarily (that is, when the license is a CC
by-nc-nd/2.5
, the result will look like so:
<license license-type="Creative Commons by-nc-nd/2.5" xlink:href="http://creativecommons.org/licenses/by-nc-nd/2.5/"> <p>Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 Generic</p> </license>
If related is present, generate a related-article for each related/relatedArticle. relatedArticle/@type becomes related-article/@related-article-type.
A relatedArticle/idno becomes ext-link. If present, the idno/@type becomes @ext-link-type.
relatedArticle/bibl is passed through; the contents of the bibl are converted as elsewhere (see the mappings for bibliographic citation elements).
Also generate a related-article for any bibl with @type='reviewTarget' that appears directly inside DHQarticle/text or any div within the DHQarticle/text. Assign a @related-article-type of "reviewTarget". Again, convert the contents of the bibl as elsewhere.
abstract becomes abstract. Its contents are mapped as they are in the article body.
Then, teaser also becomes (a different) abstract, except with an @abstract-type of "teaser". The contents of teaser are wrapped inside a p inside the abstract.
Each keywords becomes kwd-group. If present, keywords/@scheme becomes kwd-group/kwd-group-type. Each keywords/term becomes kwd-group/kwd.
Create a custom-meta-wrap, if necessary (but only if necessary), to contain any of the following:
custom-meta containing meta-name of "id no xxx" and meta-value with the value of any DHQheader/publicationStmt/idno whose @type is not one of "DHQarticle-id", "volume", or "issue", where 'xxx' is the value of the @type.
custom-meta containing meta-name of "language" and meta-value with the value of any DHQheader/langUsage/language. Assign the language/@id as the custom-meta/@id.
As described above, a front/notes element is generated if either sourceDesc or revisionDesc appears inside DHQheader/history. Map them as follows:
sourceDesc becomes a sec with a title of "Source Description". The sourceDesc/p elements map to p as elsewhere.
Similarly, revisionDesc becomes a sec with a title of "Revision Description". Inside the sec, a single list appears with @list-type='simple'. Each revisionDesc/change becomes a list/list-item containing a single p. Following the data contents of the change (inside the list-item/p), if a change/@who or change/@when appears, include them inside literal brackets as a suffix (after a space) to the change item.
So, for example,
<change who="wap" when="2007-11-09">Fixed typos</change>becomes
<item>Fixed typos [wap 2007-11-09]<item>
DHQarticle/text becomes article/body.
Wherever it occurs (at any depth), div becomes sec. If a div/@type appears, it becomes sec/@sec-type.
Wherever it occurs, text/head or div/head becomes title in the corresponding body or sec.
In general, @id wherever it appears becomes @id on the corresponding target element. Report a warning where this is not possible.
epigraph becomes display-quote, with @content-type='epigraph'.
xtext becomes boxed-text, with @content-type="floating-text". (Note that boxed-text is not only for texts rendered in a box.) Its contents map as elsewhere, including head becoming title.
letter also becomes boxed-text, with @content-type='letter'.
opener passes through.
dateline becomes p with @content-type='dateline'.
salute becomes p with @content-type='salute'.
closer passes through.
signed becomes p with @content-type='signed'.
ps becomes sec with @sec-type='postscript'.
p becomes p.
cit becomes disp-quote with @content-type='citation'. Its quote child is processed as described elsewhere, and followed by a attrib, in which the ptr, ref or bibl at the end of the cit is inserted.
quote, when it has @rend='block, becomes disp-quote with @content-type='block-quote'. When the quote has text (not paragraph-level) children, a p should be included inside the disp-quote, wrapping the text.
When quote has @rend='inline', it becomes named-content with @content-type='quote'.
eg becomes preformat.
example becomes statement with @content-type='example'. example/label becomes statement/label.
lg becomes verse-group. If present, lg/label becomes verse-group/title.
l becomes verse-line.
sp becomes speech. If sp contains any elements other than speaker, stage or p, wrap them in p and throw a warning.
speaker becomes speaker.
stage becomes p with @content-type='stage direction'.
list becomes list. Its @type maps to @list-type as follows:
"ordered" becomes "order"
"unordered" becomes "bullet"
"simple" becomes "simple"
item becomes list-item.
table becomes table-wrap containing table. Assign the table/@id, if it exists, to the table-wrap not the table.
row becomes tr.
cell becomes td.
figure becomes fig. Its element contents are transformed as indicated below, but must processed in the following order:
label
caption
figDesc
Other element contents, in document order
graphic becomes graphic. Handle its attributes as follows:
Throw a warning if @type is used.
graphic/@type should map to @mimetype, but to date no instances of it have been encountered. If it appears, a mapping to a canonical MIME type can be established for the value, or an alternative strategy considered.
@url becomes @xlink:href
If @alt-url appears, assign @alternative-available='yes' and generate a second graphic alongside; its @xlink:href will be the @alt-url, and it should have an @alternative-form-of referencing the @id of the first result graphic.
(If the source graphic has no @id and one is needed on the result graphic to accommodate @alt-url, generate a unique identifier for it.)
mediaObject becomes media. Handle its attributes the same as for graphic, except that no accommodation need be made for @alt-url.
caption becomes caption. If caption has text contents, wrap them in p inside the result caption. p contents become p as elsewhere. As with sp, if other elements appear inside caption, they must be wrapped in their own p elements (as caption only permits p in the target format).
figDesc becomes alt-text.
label becomes label.
lb is allowed only inside quote when it has text (not paragraph-level) content. If it has an @n, the lb becomes named-content with @content-type='line break', with the value of @n as its content. Otherwise, the element is dropped.
q is dropped, but its content is prefixed with a literal ““” [literal: tag as x[@x-type='archive']] and suffixed with a literal “”” [literal: tag as x[@x-type='archive']] ("curly quotes")
note generates an xref with the note/@id as its @rid. (The note itself will be picked up in the back matter.)
emph becomes named-content with @content-type='emphasis'.
hi becomes one of the following, depending on the value of its @rend:
"monospace" becomes monospace
"italic" becomes italic
"bold" becomes bold
"smcaps" becomes sc
"quotes" is dropped, but prepended with a literal ““” [literal: tag as x[@x-type='archive']] and suffixed with a literal “”” [literal: tag as x[@x-type='archive']] ("curly quotes")
"subscript" becomes sub
"superscript" becomes sup
name becomes named-content with @content-type='name'.
term becomes named-content with @content-type='term'.
code becomes named-content with @content-type='code'.
called is dropped, but its content is prefixed with a literal ““” [literal: tag as x[@x-type='archive']] and suffixed with a literal “”” [literal: tag as x[@x-type='archive']] ("curly quotes")
foreign becomes named-content with @content-type='foreign'.
ref is handled differently depending on whether its @target indicates an internal link (by starting with '#') or an external link (otherwise):
If @target starts with '#', ref is an internal link, and becomes xref, with the value of @target stripped of the '#' appearing on its @rid.
If @target does not start with '#', ref is an external link; it becomes ext-link, and the value of @target is assigned to @xlink:href.
ptr is handled exactly the same way ref is, except in addition to mapping to a target element, contents are generated for the resulting xref or ext-link, as follows:
For an internal link, the link is resolved and text is generated depending on the link target. If the link target has a title or a label, its value is used inside the resulting xref. If not, a value is generated according to the name and placement of the target element:
for note, the number of the note in the document, wrapped in sup.
for div, "Section" plus the hierarchical number of the section in the document, in "1.1" format.
for table, "Table" plus the number of the table in the document;
for figure, "Figure" plus the number of the figure in the document;
for p directly inside body, div or appendix, "Paragraph" plus the number of the paragraph in the document, counting only paragraphs inside body, div or appendix.
for anything else, generate nothing but throw an error.
For an external link, the value of the @target (that is, the URI of the link) appears as content of the ext-link (as well as on its @xlink:href).
gi becomes monospace; additionally, the value is prefixed with a '<' and suffixed with a '>'.
att, val, tag and class all become monospace.
bibl, when it has @type='reviewTarget', should be dropped (it is accounted for inside article-meta).
When bibl appears in text content, it is treated like note: an xref is generated, whose @rid names the bibl/@id. The bibl itself will be picked up in the back matter (see below).
If any of figures, notes, listBibl or appendix appears inside DHQarticle, or if any bibl or note elements are used inside DHQarticle/text, article/back is created. Inside, in this order, generate the following:
app-group if any DHQarticle/appendix elements appear. Each appendix becomes an app inside the app-group.
fn-group if any note elements appear anywhere in the text or if DHQarticle/notes appears. Each note in the text or in DHQarticle/notes becomes fn inside the fn-group. They should be listed in the order of first reference to each note, a reference being construed as either (or both) the note element itself, or a ref or ptr with that note identified by its @target, prepended with '#'.
ref-list if any bibl elements appear inside DHQarticle/text or DHQarticle/appendix, except those with @type='reviewTarget', or if DHQarticle/listBibl is used. Inside ref-list, each bibl becomes a ref/citation as indicated below. Like notes, they should be listed in order of first reference, where the reference is either the bibl itself (if it appears directly in the text) or a ref or ptr pointing to it.
If DHQarticle/figures appears, it becomes a back/sec with a title of "Figures". figure children are processed normally.
bibl becomes a ref containing a citation. The bibl/@id is attached to the ref, not the ref. The contents of the bibl, with the exception of label, become the contents of the citation.
bibl/label becomes label on the parent ref (not on the citation resulting directly from the bibl).
vol becomes volume.
date is decomposed, on the basis of its @when, into day, month and year, as described above for creating pub-date. Note that at least year should be possible for any date/@when. If a date appears without a @when, instead create named-content with @content-type='date'.
author becomes name inside person-group. Contiguous authors should be gathered in a single person-group. Within name, the entire contents of author becomes surname.
editor becomes person inside person-group in the same way as author, except that @person-group-type='editor'.
title becomes source.
pubPlace becomes publisher-loc.
publisher becomes publisher-name.
idno becomes issn if it has @type='issn', isbn if it has @type='isbn', or object-id otherwise. In the last case, @type becomes @content-type.
price becomes named-content with @content-type='price'.
extent becomes page-range.