parser://method/parameter. Reading XML from arbitrary source

Parser can read XML from arbitrary source.
Everywhere where XML can be read, one may specify the address of the document in this form…
parser://method/parameter

Reading a document from address like this is, in fact, reading the result of Parser
^method[/parameter] call.

Example of keeping XSL templates in database
@main[]

at this point $xdoc contains a document we want to transform
^xdoc.transform[parser://xsl_database/main.xsl]

@xsl_database[name]
^string:sql{
select text from xsl where name='$name'}

Relative links would be handled exactly same way as if files would be read from disk.
Say, if
parser://xsl_database/main.xsl template refers to utils/common.xsl, the document
parser://xsl_database/utils/common.xsl would be read, by calling Parser method ^xsl_database[/utils/common.xsl].


Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 21.09.2007