galtm / xslt3-functions

A collection of XSLT 3.x functions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NIST/ITL/CSD XSLT3 Functions

Courtesy of NIST ITL/CSD (Information Technology Laboratory, Computer Security Division), a library of general-use XSLT functions.

Tested and available for XSLT 3.0 and potentially related languages.

Software description

This repository offers a library of XSLT stylesheets and pipelines supporting generalized operations such as producing random UUIDs, comparing custom datatypes, validating against (dynamic or static) constraints, or other potential uses to be developed.

It is motivated primarily by the need to make available to the community and public logic that we have coded for use in our projects, but that could (more or less easily) be refitted to uses elsewhere.

Most of the code here is not intended to be used standalone, but rather as imports (generally xsl:import) from external code. As documented per utility, however, demonstrations may be included to show how to use them, which can be executed independently of any other configuration. Additionally, some functionality has been unit tested (sometimes fairly exhaustively), with unit tests included.

To use these transformations a conformant XSLT 3.0 transformation engine is required such as Saxon 11 from Saxonica (see SourceForge for the free-to-use HE version), which is available on several platforms and sometimes bundled with commercial software. Outside that practical requirement, this library is free to use and open for contributions.

Applications here for the most part assume inputs to be OSCAL XML, as distinct from OSCAL in other data formats such as JSON and YAML. Please convert your data first into XML before attempting to work further with these tools. XSLT-based data converters for OSCAL (capable of generating OSCAL XML from valid OSCAL JSON) are available in the main repository.

If there is interest in XSLT to support OSCAL JSON, YAML or other notations, please express this requirement to the developers.

Project purpose and maturity

The OSCAL project has published XSLT since 2018. Over this time it has grown in complexity, warranting a reorganization and refactoring of the development efforts that have supported it.

Current refactoring (2022) encapsulates XSLT functionality supporting OSCAL into two repositories, the OSCAL XSLT repository, and this one. This repository includes logic of general use (i.e., not specific to OSCAL use cases or implementation), and is kept kept separate in order to facilitate reuse of these offerings outside the OSCAL context, potentially (but not necessarily) as a git submodule.

Future development of this resource depends largely on uptake and engagement from users who find it valuable. If you have an interest in keeping this code base viable, please make your needs and ideas known to the developers. Demonstrations that take us further into features of XSLT 3 that are demonstrably useful, whether in functionality or architecture (e.g., packaging), are particularly welcome.

See the readme in each project to gauge its scope of application, approach to design, and level of testing. Several of the applications are also accompanied by test suites using the XSpec XSLT Unit Testing framework, and these XSpec tests run automatically in GitHub.

Repository contents

See the subdirectory list for projects and applications currently supported.

Rights and license

See the LICENSE.md file. As work product of a Bureau of the Department of Commerce (U.S. Government), or of volunteers working in support of our projects, code in this repository is in the public domain unless specifically marked otherwise.

To confirm the currency of the license, see the NIST Open license page at https://www.nist.gov/open/license#software.

Installation and use

Notes on using this library

If you are using this library, you should probably be able to skip the next subsection. Presumably you are developing XSLT of your own and wish to embed these capabilities (or extend them), not simply apply them for the purpose of capturing outputs.

Notes on running and testing XSLT

Generally speaking these are XSLT applications, either single transformations, stacked transformations (in which imported layers provide fallbacks and importing layers, customizations), or pipelines of transformations, requiring XSLT versions as recent as XSLT Version 3.0 with XPath Version 3.1.

As such they will run on any platform supporting this industry-standard, publicly available and externally specified language. The leading open-source XSLT implementation currently is Saxon from Saxonica, available for several platforms and frequently bundled with XML editors or IDE software. However, we also welcome reports respecting other XSLT implementations supporting the appropriate XSLT version (generally 3.0).

See each project for details on its runtime requirements. Most often, single and stacked XSLTs can be executed using simple calls from a command prompt, or easily configured within tools. Pipelines may be implemented in XSLT 3.0, or may be supported via XProc, or both.

To run XSpec tests locally, execute mvn test from the top level of your clone. The process picks up files with the .xspec filename extension, and the output should say [INFO] BUILD SUCCESS near the end.

If your local, in-progress work includes failing XSpec tests, you can mark them as pending or exclude them from the automatic test run. In pom.xml, the <excludes> section supports exclusions of files or directories.

Contact information

Principal software engineers responsible for these projects are

  • Wendell Piez, w e n d e l l (dot) p i e z (at) n i s t (dot) g o v
  • David Waltermire, d a v i d (dot) w a l t e r m i r e (at) n i s t (dot) g o v

In the case of applications with significant contributions from community members there may be further contact information in the project readme.

(Note however that not all contributions are credited in documentation or provided with contact info. We eagerly welcome valuable community contributions even anonymous ones.)

For help with invocation, configuration, or diagnostics, consider using the OSCAL Gitter chat channel (requires Github login), where community members can offer assistance often synchronously.

Feature requests, bug reports, and ideas for further development can be submitted to the repository Issues board.

Citation

Cite this repository as:

Piez, Wendell, David Waltermire, et al. XSLT3 Functions. https://github.com/usnistgov/xslt3-functions.

Related Material

OSCAL

This project supports the OSCAL project, a family of data models supporting activities in the domain of Systems Security, which entails not only securing systems and designing and deploying secure systems; but also the assessment, documentation and validation of security.

XSLT

XSLT, Extensible Stylesheet Language Transformations, is a fourth-generation programming language designed for the task of expediting tree-to-tree data transformations, where the trees concerned are abstracted representations of XML documents. That is, in addition to in-memory query, copy and manipulation, they are capable of being routinely and reliably produced by parsing XML, and persisted -- saved and exchanged across the system -- by serializing XML.

Version 1.0 of XSLT was released in 1999. Originally intended for the purpose of making human-legible output formats such as PDF or HTML, XSLT also has more general uses, in data extraction and acquisition, normalization, rules enforcement (validation), code generation and transpiling, literate programming, middleware and more. While maintaining its heritage as a declarative, functional language well-suited for prototyping, rapid deployment and agile development, the most recent version, XSLT 3.1, adds features such as higher-order functions and pseudo-random number generation.

The XSLT community can be found on the XML.com Slack channel and in venues such as the XSL-List listserv (email).

About

A collection of XSLT 3.x functions

License:Other


Languages

Language:XSLT 83.8%Language:XProc 10.2%Language:Shell 5.0%Language:Batchfile 1.0%