Name

ext:validate-with-relax-ng — Returns the current working directory.

Function:
{http://docbook.org/extensions/xslt}validate-with-relax-ng#2
{http://docbook.org/extensions/xslt}validate-with-relax-ng#3

Synopsis

ext:validate-with-relax-ng($node as node(),
$schema as item()) as map(xs:string, item())
ext:validate-with-relax-ng($node as node(),
$schema as item(),
$options as map(xs:string, xs:string)) as map(xs:string, item())

Description

This extension function validates the node provided against the schema. The schema can be either a string (the URI of the RELAX NG grammar file) or a node (a RELAX NG grammar document). There is no support for the RELAX NG Compact Syntax at this time.

The available options are assert-valid which defaults to true() and dtd-compatibility which isn’t actually supported yet.

If assert-valid is true() and the document is not valid according to the grammar provided, an exception is raised.

If assert-valid is false(), or the document is valid, the map returned will contain the following keys:

valid

A boolean indicating whether or not the document was valid.

document

The validated document. Today, this always returns the same node, but it may eventually return an augmented document.

errors

An array of maps containing the type (warning, error, or fatal-error), message, line, and column where an error occurred. If the document is valid, the errors key will not be present.