Purpose
The sts Ruby gem allows you to work with NISO STS and ISOSTS documents — two related XML formats for technical standards documents.
-
NISO STS (NISO Z39.96) — The standardized NISO format for journal and article publishing
-
ISOSTS — The internal precursor format to NISO STS, used by ISO before NISO standardization. ISOSTS adopts TBX (ISO 30042) for terminology markup.
|
Note
|
This is a work-in-progress. |
Formats Compared
| Aspect | NISO STS | ISOSTS |
|---|---|---|
Standard |
NISO Z39.96 (NISO standard) |
Internal format (pre-NISO standardization) |
History |
Standardized version |
Original internal format, predates NISO STS |
Root element |
|
|
Metadata |
|
|
MathML version |
3+ (via mml gem) |
2 (custom Ruby implementation) |
Math elements |
|
|
Terminology |
Inline TBX elements |
|
Standards references |
Mixed in |
Dedicated |
Module tree |
|
|
Despite sharing the same JATS ancestry, the two formats have incompatible content models. Elements with the same XML name (e.g., p, sec, disp-formula) may have different permitted children and attributes. They are implemented as completely separate Ruby class trees.
Library
Usage: NISO STS
The following code parses a NISO STS XML document.
NISO STS API
NISO STS root classes
-
Sts::NisoSts::Standard— Book or article root -
Sts::NisoSts::Front— Front matter (article-meta,journal-meta) -
Sts::NisoSts::Body— Document body -
Sts::NisoSts::Back— Back matter (references, footnotes)
Usage: ISOSTS
ISOSTS uses <standard> as the root element and includes MathML 2 for formulae. It adopts TBX (ISO 30042) for terminology sections.
ISOSTS API
# Parse
sts = Sts::IsoSts::Standard.from_xml(xml_string)
# Access elements
sts.front..title_wrap.main
sts.front..std_ident.doc_number
sts.body.term_sec.first.term_entry.lang_set.first.term
# Serialize back
sts.to_xml
sts.to_xml(pretty: true)
# Check document type
sts.class.name # => "Sts::IsoSts::Standard"
ISOSTS root classes
-
Sts::IsoSts::Standard— Standard document root (<standard>) -
Sts::IsoSts::Front— Front matter (iso-meta,reg-meta,nat-meta) -
Sts::IsoSts::Body— Document body (includesterm-secfor terminology) -
Sts::IsoSts::Back— Back matter (annexes, references, footnotes)
ISOSTS MathML 2
ISOSTS uses MathML 2 (not MathML 3+ like NISO STS). A custom Ruby implementation is provided in Sts::IsoSts::Mathml2::*:
# Access MathML 2 content
disp_formula = sts.body.sec.first.disp_formula
math = disp_formula.math # => Sts::IsoSts::Mathml2::Math
# MathML 2 elements
math.id # => "mml_1"
math.display # => "block" or "inline"
# Serialized as mml:math
math.to_xml # => <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" ...>
Available MathML 2 elements: Math, Mrow, Mi, Mn, Mo, Mtext, Mspace, Msub, Msup, Msubsup, Mfrac, Msqrt, Mroot, Mstyle, Menclose, Mpadded, Mphantom, Mtable, Mtr, Mtd, Mlabeledtr, Mfenced, Semantics, Annotation, AnnotationXml
ISOSTS TBX Terminology
ISOSTS uses TBX (TermBase eXchange, ISO 30042) for terminology sections via term-sec:
# Access terminology entries
term_sec = sts.body.term_sec.first
term_entry = term_sec.term_entry
term_entry.lang_set.each do |lang_set|
puts lang_set.xml_lang # => "en"
puts lang_set.tig.first.term # => "medical device"
end
TBX elements reuse Sts::TbxIsoTml::* classes.
TBX Integration
Both NISO STS and ISOSTS support TBX (TermBase eXchange, ISO 30042) for terminology markup. The TBX elements are in the Sts::TbxIsoTml module:
Credits
This gem is developed, maintained and funded by Ribose Inc.
License
The gem is available as open source under the terms of the 2-Clause BSD License.