Skip to content

Function API

Nico Kutscherauer edited this page Sep 22, 2024 · 5 revisions

The following functions are provided by the X(ML)² XSLT Package:

mlml:parse($href as xs:string) as element(mlml:document)
mlml:parse($href as xs:string, $config as map(*)) as element(mlml:document)
mlml:doc($xmlml-document as element(mlml:document)) as document-node()
mlml:as-node($node as element()) as node()?
mlml:serialize($xmlml-document as element(mlml:document)) as xs:string
mlml:serialize-node($nodes as element()*) as xs:string
mlml:parse-external-dtd($href as xs:string, $pubId as xs:string?) as element(dtdml:dtd)?
mlml:parse-external-dtd($href as xs:string, $pubId as xs:string?, $config as map(*)) as element(dtdml:dtd)?

The following namespaces binding was used:

Prefix Namespace URI
mlml http://www.nkutsche.com/xmlml
dtdml http://www.nkutsche.com/dtdml
xs http://www.w3.org/2001/XMLSchema

Function mlml:parse

Parses an XML file provided by $href argument and returns the mlml:document root element of the corresponding X(ML)² tree.

With an optional second argument $config a configuration map can be provided. See on the Configuration page for more details. If the second argument is ommitted the default config is detected. Providing an empty map (map{}) has the same effect.

Function mlml:doc

Converts a mlml:document element provided as argument $xmlml-document to an equivalent XDM document-node.

Note: The current implementation is not deterministic: if the function is called twice with the same XmlML document as input, it will create every time a new XDM document node. That means that mlml:doc($xmlml) is mlml:doc($xmlml) will always be false.

Function mlml:as-node

Converts one or more XmlML nodes provided as argument $nodes to equivalent XDM nodes.

Note: The current implementation is not deterministic: if the function is called twice with the same input nodes, it will create every time new XDM nodes. That means that mlml:as-node($xmlml-node) is mlml:as-node($xmlml-node) will always be false.

Function mlml:serialize

Receives a mlml:document element provided as argument $xmlml-document and returns the serialized document as string.

Function mlml:serialize-node

Receives one or more XmlML nodes provided as argument $nodes and returns a string which is created by the concatination of the serialization of each node in $nodes.

Function mlml:parse-external-dtd

Parses a DTD file provided by $href argument and returns a tree describing the DTD content. The RelaxNG schema dtdml.rnc describes the returned structure.

The second argument $pubId can be used to provide a public identifier. A configured entity resolver may use the public identifier for lookup of the effective resource of the DTD file.

With an optional third argument $config a configuration map can be provided. See on the Configuration page for more details. If the third argument is ommitted the default config is detected. Providing an empty map (map{}) has the same effect.

Clone this wiki locally