XSLT


Name:
XSLT

Description:
The XSLT handler provides XSLT transformations based on libxml2 and libxslt. Further information about these libraries is available at
http://xmlsoft.org. The input may be either an XML, HTML or Docbook SGML document. An XSL stylsesheet is applied to the paresd XML document and the result is sent back to the client. The Content-Type for the output is automatic detected, if possible. Otherwise the default Content-Type of the server is used. POST requests are also supported.

Options:
Option Default Values Short Description Example(s)
DefaultStylesheet - <path name or URL> A valid path name or URL to be used to load the XSLT stylesheet DefaultStylesheet "./Default.xsl"
DefaultContentType - <a mime type string> A valid mime type to overwrite XSLT engine selection DefaultContentType "application/rtf"
MaxDepth 500 <a number> The maximum depth of template stack Example
Variable - <a Pi3Expression> A variable definition Variable "GATEWAY_INTERFACE=CGI/1.1"
ExtraHeaders Yes Yes|No Indicates if extra headers are considered ExtraHeaders Yes
ExtraHeadersPrefix - <a string> Used as prefix of each extra header ExtraHeadersPrefix "HTTP_"
ExtraHeadersIgnore - <Space delimited strings> List of unconsidered extra headers ExtraHeadersIgnore "Content-Type Content-Length"
Options - Options flags as described below Options which effect behaviour Options "NoNetEntities | Verbose"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

DefaultStylesheet
This parameter is used to apply the given stylesheet instead the stylesheet ignoring any stylesheet in the source file. A relative path is treated from the current working directory, which is the directory from where the server has been started. This is different to other external entity paths, e.g. dtd or styleshet paths in an xml file.
DefaultContentType
This parameter is used to set the mime type used in the server response to a given value. Otherwise the selection is done by the handler itself supported by the XSLT engine.
MaxDepth
Adjust the maximum depth of the template stack before libxslt concludes it is in an infinite loop. The default is 500.
Variable
Specifies a server variable expression to be set as a global stylesheet parameter. Could be set multiple times in one configuration object up to 32.
ExtraHeaders
This configuration key defines, if extra headers are considered by the processing of this handler as global stylesheet parameters.
ExtraHeadersPrefix
This configuration value will be the trailing string of each extra request header.
ExtraHeadersIgnore
The headers in this list are not treated as extra headers.
Options
Specifies options which effect the behaviour of the XSLT transformations, many available facilities are optional for performance reasons, the table below lists the available option flags with their meanings.
Option Meaning
SkipDtdLoading Skip loading the document's DTD.
Validate Validate the document against it's DTD.
NoNetEntities Do not use the Internet to fetch DTD's or entities.
WarnNetEntities Output notification when DTD's or entities are fetched over the Internet. Not implemented yet.
Verbose Output each step taken by XSLT in processing the stylesheet and the document in the server debug log. Debug logging must be enabled in addition.
XInclude Process the input document using the Xinclude specification. More details on this can be found in the Xinclude specification: http://www.w3.org/TR/xinclude/
SgmlCatalogs Use catalogs to resolve the location of external entities. This speeds DTD resolution. By having a catalog file point to a local version of the DTD, XSLT does not have to use the Internet to fetch the DTD. XSLT uses the catalog identified by the environmental variable SGML_CATALOG_FILES.
Html The input document is an HTML file.
Docbook The input document is DocBook SGML. This is not to be used for DocBook XML documents.
Timing Display the time used for parsing the stylesheet, parsing the document and applying the stylesheet and saving the result. Displayed in milliseconds. Not implemented yet.
Profile Output profiling information detailing the amount of time spent in each part of the stylesheet. This is useful in optimizing stylesheet performance. Not implemented yet.
Debug Output an XML tree of the transformed document for debugging purposes on STDOUT.
Multiple options may be listed together by seperating them using the pipe ('|') character. Whitespace will be stripped from the option pattern. Options are matched without regard to case sensitivity. Unknown options will raise a configuration error. The option directive may be repeated multiple times.

Notes:
Some of the configuration options are not reentrant. None of the options are applied, when the DefaultStylesheet is loaded at server startup. Embedded stylesheets work only with enabled option "Validate", which is probably a bug in libxml2 (2.4.20). The libxml 2 has been compiled _REENTRANT and with some minor changes. Thus other binary distribution of libxml2 might not work with Pi3Web. For POST requests the received form data must be of Content-Type "text/plain" or "application/x-www-form-urlencoded". The received form is converted into a generic XML format, which follows this simple DTD:

<!DOCTYPE form [
	<!ELEMENT form (field+)>
	<!ELEMENT field #PCDATA>
	<!ATTLIST field name NMTOKEN #REQUIRED>
	]
>

Phase:
HANDLE

Returns:
PIAPI_COMPLETED, PIAPI_ERROR, or INT_REDIRECT accordingly to the status returned by the handler.

Example:

	<Object>
		Name XSLT
		Class XSLTClass
	</Object>

	<Object>
		...
		Handle Condition="&cmp(&dblookup(response,string,ObjectMap,XSLT),XSLT)" \
			XSLT
		...
	</Object>