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
The XSLT document function

Xsltp.pl XSLT engine implemets the document function in a context independent way. It is simpler than sophisticated XSLT 1.0 document function. The function has the type
node-set  document(object,object?)
The first argument is the file name, and the second argument is the file base ("base URI"). If one or both are node-sets then a node-set of root nodes of documents is returned. Examples,
<!-- if xsltp:xml-base is not set the first function is   --> 
<!-- equivalent to the document function with one argument --> 
document('my.xml',$source)
document('my.xml',$style)
The first document function loads the my.xml document from the same directory as the source file, the second, from the same directory as the style file. The document function with two arguments doesn't depend on the file names ("URI") of the XSLT stylesheet or XML source.

In version 1.5 one argument document function behavior has been changed. If the argument is a node-set then the string value of each node is used as a file name and the path of the node document is used as the file base. The processor returns the union of ducuments. If the argument is a string it is used as a file name with the location of XSLT stylesheet being the file base.

Remark (v1.0 only). If the XSLT stylesheet employs the document function with one argument in the context of the XML source document (e. g. document(@file)) then the document function of the xsltp.pl XSLT processor is identical to XSLT 1.0 document function. If it is used in the XSLT stylesheet context then XSLT 1.0 document function is identical to document('my.xml',$style).
Copyright © 2004 www.dopscripts.com