Metanorma presentation XML and ISO/NISO STS mapping
General
This set of mapping rules is realized in the mnconvert command-line tool.
mnconvert
is based on XSLT 1.0 (with
Apache Xalan extensions) and allows to convert data:
-
from Metanorma presentation XML to ISO/NISO STS XML (module
mn2sts.xsl
) -
from ISO/NISO STS XML to Metanorma AsciiDoc (module
sts2mn.adoc.xsl
) -
from ISO/NISO STS XML to Metanorma presentation XML (module
sts2mn.xsl
)
Stages of conversion from ISO/NISO STS XML to Metanorma AsciiDoc (sts2mn.adoc.xsl
):
-
XML linearization – replace all line breaks (except text in the tags
code
,preformat
andmml:
) to space, replace sequence of spaces into one space -
replace
bold
,italic
,underline
,sup
andsub
tags tobold2
,italic2
,underline2
,sup2
andsub2
for unconstrained formatting pair for further processing -
reference`s id normalization in the elements
ref
andstd
-
replacing a space, non-break space, colon to low line char
_
(U+5F) -
replacing non-breaking hyphen minus to hyphen minus char
-
(U+2D) -
adding
low line
char_
(U+5F) prefix ifid
starts with digit
-
-
conversion from ISO/NISO STS XML to Metanorma AsciiDoc
-
checking for repeated bibliography references
-
copy images from the folder, specified by
imagesdir
(command line parameter, default valueimages
), to the output folder
Note
|
First page data and each section (first level clause/annex) saves in a
standalone |
Stages of conversion from ISO/NISO STS XML to Metanorma presentation XML (sts2mn.xsl):
-
conversion from ISO/NISO STS XML to Metanorma presentation XML
-
if non-processed elements in front page (bibliographic) data found, then it will be added at the end of the
<bibdata>
element with message 'WARNING! There are unprocessed elements in 'front'' -
if non-processed elements found, then such element’s names will be added in comments at the end of XML file
-
checking on repeated bibliography references
-
copy images from the folder, setup by
imagesdir
(command line parameter, default valueimages
), to the output folder
Stages of conversion from Metanorma presentation XML to ISO/NISO STS XML to
(mn2sts.xsl
):
-
conversion from Metanorma presentation XML to ISO/NISO STS XML
-
if non-processed elements in front page (bibliographic) data found, then it will be added at the end of the
<bibdata>
element with message 'WARNING! There are unprocessed elements in bibdata'
Legend:
-
< >
- bidirectional rule (Metanorma presentationXML to and from STS NISO/ISO XML) -
<
- unidirectional rule, from Metanorma presentation XML to STS NISO/ISO XML -
>
- unidirectional rule, from STS NISO/ISO XML to Metanorma presentation XML
Note
|
This mapping is not a full ISO/NISO STS schema comparison and based on 30 XML samples only:
|
Note
|
The corresponding ISO STS mapping rule is not given if it is identical to
NISO STS structure.* > - unidirectional rule, from STS NISO/ISO XML to Metanorma presentation XML
|
Note
|
The NISO STS schema is available at NISO’s tag library. |
Note
|
In the mapping tables the value 'indirect' is used to indicate that there is no one-to-one mapping from an ISOSTS element to a corresponding Metanorma presentation XML element. This does not mean that the data is ignored, instead it means that the text inside this element will be copied into the resulting Metanorma XML, or that its internal elements is processed into alternative elements. |
Main parts (front page, body, annexes)
Root element
NISO STS: <standard>
, <adoption>
Metanorma: <abc-standard xmlns="https://www.metanorma.org/ns/abc">
,
where abc
stands for the type of standard: iso
or bsi
.
Determined automatically in sts2mn.xsl
:
-
if
/standard/front/nat-meta/@originator
=BSI
or/standard/front/iso-meta/secretariat
=BSI
, thenbsi
-
else
iso
,
OR can be set up any value in the command line via parameter --type iso
.
Sections
ISO/NISO STS | Metanorma presentation XML | Metanorma AsciiDoc | |||||
---|---|---|---|---|---|---|---|
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
if there is |
|
|
|
||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|
||||
|
|
||||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
|
||||
|
|
indirect |
|||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
skip processing
|
|||||
|
|
skip processing
|
|||||
|
|
|
|
||||
|
|
|
|
||||
|
|
indirect |
|||||
|
|
indirect |
|||||
|
|
indirect |
|||||
|
|
annex/@obligation |
|
||||
|
|
annex/@obligation = informative |
|||||
|
|
annex/@obligation |
|||||
|
|
|
|||||
|
|
indirect |
|||||
indirect |
|
|
|||||
|
|
|
|||||
sub-part
|
|
|
YAML collection document
|
||||
indirect |
|
|
Front page (bibliographic) data
STS XML can contains nat-meta, iso-meta, reg-meta and std-meta at the same time. The conversion rules are:
-
if there is
nat-meta
, then-
nat-meta
goes tobibdata
-
iso-meta
goes tobibdata/relation[@type = 'adopted-from']/bibitem/contributor[role/@type = 'publisher']/organization[abbreviation = 'xxx']
(xxx = ISO or IEC) -
reg-meta
goes tobibdata/relation[@type = 'adopted-from']/bibitem/contributor[role/@type = 'publisher']/organization[abbreviation = 'xxx']
(xxx = CEN or CENELEC) -
std-meta
goes tobibdata/relation[@type = 'adopted-from']/bibitem/contributor[role/@type = 'publisher']/organization[abbreviation = 'xxx']
(xxx != ISO, IEC, CEN, CENELEC)
-
-
if there isn’t
nat-meta
, then-
iso-meta
goes tobibdata
-
reg-meta
goes tobibdata/relation[@type = 'adopted-from']/bibitem/contributor[role/@type = 'publisher']/organization[abbreviation = 'xxx']
(xxx = CEN or CENELEC) -
std-meta
goes tobibdata/relation[@type = 'adopted-from']/bibitem/contributor[role/@type = 'publisher']/organization[abbreviation = 'xxx']
(xxx != ISO, IEC, CEN, CENELEC)
-
In STS→Metanorma AsciiDoc conversion, only first (by priority nat
-, iso-
,
reg-
, std-meta
) element is using for destination Metanorma AsciiDoc, for all
another elements – only document number is populating into ‘:adopted-from:…’
(see
https://github.com/metanorma/sts2mn/issues/31)
ISO/NISO STS | Metanorma presentation XML | Metanorma AsciiDoc | |||||
---|---|---|---|---|---|---|---|
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
indirect |
|||||
|
|
docidentifier[1], before ':' |
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|
||||
|
|
indirect |
|||||
|
|
skip processing
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
indirect |
||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
skip processing |
|
||||
|
|
|
WD: |
||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
|
||||
|
|
tries to extract 'TC', 'SC', 'WG` values and put them into: |
|
||||
|
|
|
|
||||
|
|
|
|||||
|
|
||||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|
||||
indirect
|
|
|
|||||
|
|
|
|
||||
|
|
||||||
|
|
|
|
||||
|
|
|
|||||
|
indirect |
||||||
indirect |
|
||||||
indirect |
|
||||||
indirect |
|
||||||
|
indirect |
||||||
|
indirect |
||||||
|
indirect |
||||||
|
indirect |
||||||
|
indirect |
||||||
|
|
|
|||||
|
|
|
|||||
indirect |
|
|
|||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|
||||
indirect |
|
||||||
fixed: |
|||||||
|
|||||||
|
Section title
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||
---|---|---|---|---|---|
|
|
|
|||
|
|
|
|
||
skip processing |
|
|
|||
skip processing |
|
|
Terms
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||||||
---|---|---|---|---|---|---|---|---|---|
|
|
If there is no child
|
|||||||
|
|
skip processing
|
|||||||
|
|
indirect |
|||||||
|
|
term |
|||||||
|
|
term |
|||||||
|
|
|
|||||||
|
|
|
|
||||||
|
|
|
|
||||||
|
|
indirect |
|||||||
|
|
indirect |
|||||||
|
|
skip processing
|
|||||||
|
|
|
|||||||
|
|
|
|
||||||
|
|
|
|
||||||
|
|
|
|||||||
|
|
|
|||||||
|
|
|
|||||||
|
|
|
|
||||||
|
|
see above |
|||||||
|
|
indirect |
|||||||
|
|
|
|
||||||
|
|
|
|
||||||
|
|
|
|||||||
|
|
|
|||||||
|
|
|
|||||||
|
|
|
|||||||
[example%unnumbered]
|
|
|
|||||||
|
|
|
|
||||||
|
|
|
|||||||
|
|
|
|||||||
|
|
Text formatting elements
Note for NISO STS→Metanorma AsciiDoc conversion: is some cases unconstrained formatting pair used, see AsciiDoc unconstrained text.
Paragraph
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||||
---|---|---|---|---|---|---|---|
|
|
|
|||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
indirect |
|
|
Boldface text
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|
---|---|---|---|
|
|
|
|
Note
|
For NISO STS→Metanorma presentation XML conversion: in case of 'bold' inside 'std', then 'bold' will be moved outside 'std'. |
NISO STS: <std><bold><std-ref>ISO 10667 series</std-ref></bold></std>
Metanorma: <strong><eref citeas="ISO 10667 series" type="inline">ISO 10667 series</eref></strong>
Italic text
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|
---|---|---|---|
|
|
|
|
Note
|
For NISO STS→Metanorma presentation XML conversion: in case of 'italic` inside 'std', then 'italic` will be moved outside std. |
NISO STS: <std><italic><std-ref>BS 5839-1:2013</std-ref></italic></std>
Metanorma: <em><eref citeas="BS 5839-1:2013" type="inline">BS 5839-1:2013</eref></em>
Underlined text
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|
---|---|---|---|
|
|
|
|
Subscript formatting
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|
---|---|---|---|
|
|
|
|
Superscript formatting
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||
---|---|---|---|---|---|
|
|
|
|
||
skip
|
|
|
Note
|
For NISO STS→Metanorma presentation XML conversion: sup formatting will be ignored if it contains xref[@ref-type='fn'] inside.
|
NISO STS: <sup><xref ref-type="fn" rid="fn_1"><sup>1)</sup></xref></sup>
Metanorma: <fn reference="1"><p><eref citeas="BS 8889" type="inline" bibitemid="BS_8889">BS 8889</eref> was in development at the time of publication.</p></fn>
Monospaced text
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|
---|---|---|---|
|
|
|
`…` |
Small caps text
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|
---|---|---|---|
|
|
|
|
Line break
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|
---|---|---|---|
|
|
|
+ |
Source code, pre-formatted text
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||
---|---|---|---|---|---|
|
|
|
|
||
|
|
|
|
||
|
|
|
|
||
|
|
|
Note
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||
---|---|---|---|---|---|
|
|
|
|
||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
Example
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|
---|---|---|---|
|
|
|
|
|
|
indirect |
|
|
|
|
|
|
indirect |
Link
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||
---|---|---|---|---|---|
|
|
|
|||
|
|
|
|||
|
|
indirect |
|||
|
|
indirect |
|||
|
|
|
|
||
|
|
|
|
Reference
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||||
---|---|---|---|---|---|---|---|
|
|
|
if @ref-type = 'other': if @ref-type = 'sec' and reference to 'term-sec':
|
||||
|
|
|
|||||
|
|
indirect |
|||||
|
|
indirect |
|||||
|
|
|
ELSE |
||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
indirect |
|
||||
|
|
|
XML:
ADoc:
|
||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
NOTE: instead of |
|||||
|
|
|
|||||
|
|
|
|||||
there isn’t any entity with id="BS 0:2011".
|
|
|
|
||||
|
|
indirect |
|||||
|
|
|
|||||
|
|
indirect |
|||||
|
|
|
|||||
|
|
|
Formula
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|
---|---|---|---|
|
|
|
|
|
|
|
as is in MathML |
|
|
|
|
|
|
|
|
|
|
||
|
NO id |
|
Quote
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||
---|---|---|---|---|---|
|
|
|
|
||
|
|
|
|||
|
|
|
|
||
|
|
|
|||
indirect |
|
|
|||
indirect |
|
|
|||
|
|
|
|||
|
|
|
|
||
|
|
|
|||
skip processing
|
|
|
|||
skip processing
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
Footnote
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||
---|---|---|---|---|---|
|
|
|
|
||
|
|
indirect |
|||
|
|
indirect |
|||
|
|
|
|||
|
|
||||
|
|
|
|
||
|
|
|
|
||
|
|
|
|
||
NOTE:removing ')' |
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
||||
|
|
Amendment
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||
---|---|---|---|---|---|
indirect |
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
indirect |
|
|
|||
|
|
|
|||
|
|
|
|||
Annotation
ISO/NISO STS | Metanorma presentation XML | Metanorma AsciiDoc | |||
---|---|---|---|---|---|
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
Other
ISO/NISO STS | Metanorma presentation XML | Metanorma AsciiDoc | |||
---|---|---|---|---|---|
|
|
|
indirect |
||
|
indirect |
||||
|
|
|
Tables
Note
|
In Metanorma presentation XML there aren’t elements for NISO/ISO STS XML
elements 'table-wrap' , 'table-wrap/label' , 'table-wrap/caption' , therefore
they transform to data inside Metanorma presentation XML element 'table' .
|
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||||
---|---|---|---|---|---|---|---|
|
|
skip processing
|
|||||
|
|
|
|
||||
|
|
indirect |
|
||||
|
indirect |
||||||
|
|
|
before table: after table: |
||||
|
|
|
|||||
|
skip processing
|
||||||
|
|
|
|
||||
|
|
|
if parent is |
||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
indirect |
||||
|
|
|
indirect |
||||
|
|
|
indirect |
||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|||||
|
|
||||||
|
|
||||||
|
|
|
|
||||
|
|
|
|||||
|
|
<th …
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
List
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||
---|---|---|---|---|---|
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|
||
|
|
|
|
||
|
|
|
|
||
|
|
|
|
||
|
|
|
|
||
|
|
|
|||
|
|
|
|
||
|
|
|
|
||
|
|
|
|||
|
|
|
|
||
|
|
|
|||
|
indirect |
indirect |
|||
|
|
|
indirect |
||
|
|
|
if list/@list-type = 'bullet' 'dash' or simple: else
|
||
|
|
indirect |
|||
|
|
Evaluate by ul,ol/@type, @start |
Definitions list
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||
---|---|---|---|---|---|
|
|
|
|||
|
|
indirect |
|
||
|
|
skip processing
|
|||
|
|
|
|
||
|
|
|
|
||
|
|
|
|
||
|
|
|
|
||
|
|
|
|||
|
|
|
|
Image
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||||
---|---|---|---|---|---|---|---|
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
indirect |
||||||
|
|
|
if starts with 0: |
||||
|
|
figure/name
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
|
|
<name>a) … </name)
|
|||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
indirect |
|
||||||
indirect |
|
||||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|||||
|
|
|
|
||||
indirect |
|
||||||
|
|
indirect |
|
Bibliography
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||
---|---|---|---|---|---|
|
|
|
|
||
|
|
|
|
||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|
||
|
|
|
|||
|
|
|
|||
|
|
indirect |
|||
|
|
|
|||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect
|
|
|
|||
indirect
|
|
|
|||
indirect NOTE: commented |
|
|
|||
indirect NOTE: commented |
|
|
|||
indirect NOTE: commented |
|
|
|||
indirect NOTE: commented |
|
|
|||
indirect NOTE: commented |
|
|
|||
indirect NOTE: commented |
|
|
|||
indirect NOTE: commented |
|
|
|||
indirect NOTE: commented |
|
|
|||
indirect NOTE: commented |
|
|
|||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
indirect |
|
||||
|
|
|
|||
indirect |
|
||||
|
|
|
|||
indirect |
|
||||
see rules for text formatting elements |
|
Processing instructions
ISO/NISO STS |
Metanorma presentation XML |
Metanorma AsciiDoc |
|||
---|---|---|---|---|---|
|
|
indirect, ignores |
|||
|
|
copy 'as is', for round-trip conversion |
|||
|
|
copy 'as is', for round-trip conversion |
|||
|
|
|
|
||
|
|
|
|||
|
|
|
|