Home
XSLT Processor
Website Editor
CGI XSLT Processor
The style and source
Global parameters
Stylesheets
Stylesheet elements
Functions
Files upload
Details
Characters model
Data types
Result tree fragments
Variables scope
Conflict resolution
The key function
The document function
Curly brackets in attributes
Extensions
Extension modules
XSL message handlers
XML tree class
XSLT stylesheet top elements

Any stylesheet which can be processed by xsltp.pl CGI XSLT processor must contain the xsl:stylesheet (xsl:transform) element. This means that literal result elements are never treated as a stylesheet. The last restriction is necessary if you don't wish that xsltp.pl XSLT parser can display any xml files on your host. Notice also that if you don't overwrite the default template
<xsl:template match="/"><xsl:apply-templates/></xsl:template>
your stylesheet can display text data of any xml file! Always define the template above in the stylesheets direct call of which is not desired, e. g.
<xsl:template match="/"><html><body>text</body></html></xsl:template>
Supported top level elements:
xsl:template
xsl:key
xsl:include
xsl:import <!-- Synonym for xsl:include, xsl:apply-imports instruction is not supported. -->
xsl:variable
xsl:param
xsl:output <!-- In addition, xsltp.pl XSLT parser supports omit-http-headers attribute 
Since version 1.5 we do not support indent attribute -->
xsl:namespace-alias 
<!--Namespace prefix defined by the stylesheet-prefix attribute will be 
replaced by the result-prefix attribute value provided that output method is xml.
Xsltp.pl processor does not support namespaces. This instruction is useful only if 
result-prefix="xsl" or to the prefix of some loaded extension module.--> 

Not supported top level elements:
xsl:strip-space, xsl:preserve-space, xsl:decimal-format, xsl:attribute-set
The strip-space and preserve-space XSLT elements are used to define the string values of nodes more precisely. The program employs a fixed data model. It merges all nearest text nodes then removes text nodes that contain just space characters except text nodes of PCDATA elements. The attribute-set element is a redundant instruction.

Extra top level elements of xsltp.pl Perl XSLT parser:
<xsltp:max-content-length select="integer"/>
The sum of the select attribute values of all xsltp:max-content-length elements plus 1024 is the maximum value of HTTP content-length permitted.
<xsl:message>
It defines a message, which will be displayed if an error occurs. The error will be stored in xsltp.log file. If the top message element is not set the error will be printed to STDOUT. Notice that even if the stylesheet itself has no errors, the parameters passed may have invalid values. Moreover, you can pass XPATH expressions as stylesheet parameters. The element xsl:message or xsl:include instruction that imports stylesheet with the top xsl:message element must be the last elements of the stylesheet so that the program can read them first. You can get the error string as <xsl:value-of select="error"/> (v>=1.5). The element will not be compiled until the error heppens. XSL message handler can be used inside to send the error to the administrator e-mail. Since 1.5 all errors are saved in xsltp.log file.
<xsltp:xml-base select="string"/>
<!-- since 1.5 expression can be used. It is evaluated
with respect to root node of the source document -->
<xsltp:xml-base select="{XPath expression}"/>
The value of the select attribute of this element will be used as the files base for the document function with one parameter and for file storage with the xml-document element. Since version 1.5 it has no effect on the document function. It is an error if more than one xml-base element declared. Stylesheets with no xml-base element will use the base of the file passed trough the source parameter if any. It is used for publishing purposes.
<!-- since 1.5 this element is no longer supported -->
<xsltp:http-output name="string"> template </xsltp:http-output>
These elements set http headers. If they are absent then only Content-type: text/html will be output provided that the omit-http-headers attribute of the xsl:output element is not set to "yes". These elements are instantiated with respect to the root node of the source document. Example of useful http field is the location field that can redirect a browser to the program output. The content of http-output is converted to string with the normalize-space function. The order of http fields output is the document order.
<!-- version >=1.5 --> 
<http:headers>
template
</http:headers>
<!-- the template must produce the list of elements -->
<http:field name="name of field">its value</http:field>
The http:headers element can be used as an extension element provided that xmlns:http="#DOPS/Extensions/http.pm" is set.
Copyright © 2004 www.dopscripts.com