A PWP template is a program. The values of pwp:ask, pwp:use
and the
‘c(...)c and c[...]c` parts of attribute
values are read as Prolog terms and executed with full privileges, and
the text-file, xml-file and pwp-file
values of pwp:how read arbitrary files (pwp-file
also executes the embedded queries). Templates must therefore be trusted
in the same way as Prolog source code. Notably:
- Never process PWP documents that may be supplied or modified by
untrusted users, for example files in an upload directory that is served
by pwp_handler/2.
- Data that is substituted into a page is not interpreted as PWP, but
do not use request data to construct goals, format strings or file names
in templates.
- [det]pwp_files(:In:atom,
+Out:atom)
- loads an Xml document from the file named In, transforms it
using the PWP attributes, and writes the transformed version to the new
file named Out.
- [det]pwp_stream(:Input:input_stream,
+Output:output_stream, +Context:list)
- Loads an Xml document from the given Input stream, transforms
it using the PWP attributes, and writes the transformed version to the
given Output stream. Context provides initial
contextual variables and is a list of Name=Value.
- pwp_xml(:In:list(xml),
-Out:list(xml), +Context)
- maps down a list of XML items, acting specially on elements and copying
everything else unchanged, including white space. The Context
is a list of ’VariableName’=CurrentValue bindings.