PTC ALD in Arbortext Styler > Components of Documents and Templates > XML > XSLT in PTC Arbortext Layout Developer
XSLT in PTC Arbortext Layout Developer
XSLT is one of a number of transformation methods provided by PTC Arbortext Layout Developer. XSLT can be applied to a text stream object, fStream, or it can be applied inline to a specific node. Inline XSLT can currently only be applied using an PTC Arbortext Layout Developer processing instruction, but FOM support is planned.
XSLT Properties on fStream Object
When setting up a transformation for a content stream, some transformation properties must be applied to the text stream that will receive the output from the transformation:
fStream.transformType — specifies a type of transformation from the list specified by the fStream.TransformType constant
This example code requests an XSLT transformation:
var stream = template.content.getStream("myXSLTOutput");
stream.transformType = fStream.TRANSFORM_XSLT;
fStream.transformSource — specifies the input stream for the XSLT transformation
The content must be well-formed XML.
The specified source object is an fStream object.
This example code specifies the source stream mySourceXML:
var source = template.content.getStream("mySourceXML");
stream.transformSource = source;
fStream.transformFrequency — specifies how often to perform the transformation
The fStream.TransformFrequency constant lists the transformation frequency options:
AUTO — automatic, carried out whenever the source changes
AUTOSAVE — automatic, saving the results in the file
MANUAL — one manual run, preserving the settings in case further passes are required
ONCE — one manual run, discarding the settings
The frequency must be specified.
This example code requests an automatic transform when source changes:
stream.transformFrequence = fStream.TRANSFORM_AUTO;
fStream.transformCtrl — specifies the fStream object (tag) that contains the XSLT stylesheet
fStream.transformParams — specifies an fStream object that can be used to provide initial XSLT parameter values to the transformation
This property is optional.
Errors in the XSLT reported by PTC Arbortext Layout Developer’s XSLT engine appear in an PTC Arbortext Layout Developer tag. The tag has the same name as the XSLT tag but is located in the xerror namespace. The last error code reported is also provided in the fStream.xsltTransformError property. This allows you to test whether a transformation is successful.