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