/yin-tools

Tools for working with XML syntax of YANG (YIN)

Primary LanguageXSLTGNU General Public License v3.0GPL-3.0

YIN Tools

This repository contains various tools that aids in editing, processing and validating YANG modules in the alternative XML syntax named YIN.

RELAX NG schemas

The schema directory contains two RELAX NG schemas:

The RELAX NG schema can be used for validating a YANG module (in the YIN syntax, of course). The validate target of the included Makefile shows how it can be done with the Jing tool.

The schemas can also be used with schema-aware XML editors, such as oXygen or Emacs with nXML mode, to provide on-the-fly validation, YANG statement completion and other neat features.

Some XML tools can only work with the RELAX NG compact syntax. The latter can be obtained by running

$ make

in the schema directory (provided that trang is instaled),

XSLT stylesheets

The xslt directory contains the following XSLT stylesheets:

The included Makefile can be used for converting any number of (sub)modules in the extended YIN syntax (hence with the .yinx extension) to the compact YANG syntax, while also

  • canonicalizing the order of statements, and
  • using the current date for the latest revision of each (sub)module.

HTML-like extensions to YIN

Arguments of some YANG statements often contain longer text containing multiple paragraphs, bulleted lists etc. Maintaining such text structures without any markup is difficult and error prone. RELAX NG schema yin-html.rng and XSLT stylesheets therefore support the following XML elements in the XHTML namespace (http://www.w3.org/1999/xhtml) as an extension to the standard YIN syntax:

  • <p> – paragraph of text
  • <br> – unconditional line break inside a paragraph
  • <ul> – unordered list
  • <ol> – ordered list
  • <li> - list item

The <p>, <ul> and <ol> elements are only permitted as children of the YIN <text> element, i.e. inside arguments of the following YANG statements: contact, description, error-message and organization.

In order to distinguish this extended syntax from the original YIN syntax, it is recommended to use the .yinx extension for files containing such modules.