4D v13.4

XSLT APPLY TRANSFORMATION

Home

 
4D v13.4
XML
XSLT APPLY TRANSFORMATION

XSLT APPLY TRANSFORMATION 


 

XSLT APPLY TRANSFORMATION ( xmlSource ; xslSheet ; result {; compileSheet} )  
Parameter Type   Description
xmlSource  String, BLOB in Name or access path of XML source document, or BLOB containing the XML source
xslSheet  String, BLOB in Name or access path of document containing XSL stylesheet, or BLOB containing the XSL stylesheet
result  String, BLOB in Name or access path of the document receiving the result of the XSLT transformation, or BLOB receiving the result of the XSLT transformation
compileSheet  Boolean in True = Optimize XSLT transformation False or omitted = No optimization, remove the compiled XSL file (if any)

The XSLT APPLY TRANSFORMATION command applies an XSLT transformation to a document or a BLOB containing XML and generates a document or a BLOB result. The scope of this command is the current process.

Note: For more information about XSL transformation (or XSLT), refer to the Overview of XML Utilities Commands section.

The command requires three BLOBs or character string parameters.
Warning
: This command only accepts variables or fields as parameters.

If you pass a character string, you designate a document. In this case, you can only pass the name (the document must be next to the database structure) or the full access path of the document.
You cannot mix different types of parameters within the same call.

  • The xmlSource parameter must contain the XML source to transform. The command checks the validity of the XML code.
  • The xslSheet parameter must contain the XSL style sheet to use for the XSLT transformation. This style sheet may have been generated manually or using speciality software. The command checks the validity of the XML code.
  • The result parameter must contain the name of the document or the BLOB that must receive the result of the XSLT transformation. If you pass a document name that does not exist at the designated location, 4D creates it automatically. If the document is already open with write access, an error is generated.

The command parses the XML source and transforms it using the instructions in the XSL style sheet. If the XSLT SET PARAMETER command was used beforehand, the command replaces the parameters defined by their value. The result of the transformation is written in the document or BLOB result.

The optional compileSheet parameter can be used to optimize the XSLT transformation, more particularly in the case of successive applications of the same XSL style sheet. When the compileSheet parameter is passed and is set to True, the XSL file xslSheet is parsed on the first call of the command, then is compiled and stored in memory. On each subsequent call with the same XSL sheet, the command uses the compiled file directly (unless it has been modified), which can accelerate processing. Optimization does not take into account any modifications carried out in the imported file (via xsl:import). If a file referenced by the XSL file is modified, it is necessary to “force” the recompiling of a new XSL file by calling the command again with the compileSheet parameter set to False (or omitted).

Example  

Refer to the example of the XSLT SET PARAMETER command.

If the transformation was executed correctly, the system variable OK is set to 1. Otherwise, it is set to 0.

 
PROPERTIES 

Product: 4D
Theme: XML
Number: 882

The OK variable is changed by the command

 
INDEX

Alphabetical list of commands

 
HISTORY 

Modified: 4D v11 SQL
Renamed: 4D v12

 
SEE ALSO 

XSLT GET ERROR
XSLT SET PARAMETER