Macro Language Reference > Macros > Text (Page Level) > txform
  
txform
Description
Permits you to carry out an XSLT transformation of an PTC ALD tag
 
Example 311. Perform an XSLT transformation in APP
Below is a basic example of the syntax required to perform an XSLT transformation in APP. The tag to be transformed comes first, followed by the relevant number for the frequency of the transformation: in this case zero denotes a fully automatic transform. The next entry is the type of transformation to be performed, ie. XSLT, then the name of the source tag. Finally, a stylesheet control tag is defined in order to carry out the transformation.
txform "destination_tag",0,4,"source_tag","stylesheet"
Syntax
txform tag name:s frequency:s type:n source tag:s control tag:s?
parameter control tag:s?
txform
[no parameter]
Invoke the Tag Transform dialog box.
tag name
The name of the target tag be overwritten: if this tag does not exist it will be created.
frequency
The frequency at which the transformation is to be carried out:
0
Fully automatic: the transformation will always take place until it is disabled. You will not be able to edit the result stream. If you try to edit the result stream, you will be presented with the Attempted change to a transformed tag dialog box. It is possible to overwrite the transformation you have set up by clicking the Disable Transform button. The results of the transformation are not saved with the .3d file. An empty tag contains information telling PTC ALD where and how the tag was generated so that it can be regenerated when required. This allows a smaller .3d file to be saved in contrast to the Fully automatic and save result in file option described below.
1
Fully automatic and save result in file: ensures that the tags generated as a result of the transformation are saved with the .3d file. This creates a larger file than the Fully automatic option described above.
2
Manual updates only: performs the transform just once, but saves the txform information with the generated tag.
3
One-off transform only: creates a new tag and discards the transformation txform information with the generated tag.
type
The type of transformation to be carried out:
0
None (disabled). Because transformation information is stored within a tag and that tag can be protected from updates, it is sometimes necessary to disable the transformation. Example: txform "result",0,0
1
Exact copy: use an exact copy of the source stream.
2
Translation map: enable the user to use the smaps.3ad style character maps.
3
Search/replace miniscript: enable a series of search and replace actions to be performed on the source stream.
4
XSLT transform: apply an XSLT to the source stream.
5
Output XML tree - preserve whitespace: keep the whitespaces present in the source stream.
6
Output XML tree - strip "default" whitespace: as above, but removes all white space between tags.
7
SAX parse XML stream
8
Perl script
source tag
The name of the source tag for the transformation
control tag
(Optional) The control tag or stylesheet to be used for the transform: this is the name of the stream that contains the XSLT stylesheet, the translation map, the search and replace script, etc.
parameter control tag
(Optional) The parameter control tag or stylesheet to be used for the transform: a parameter control tag can be used to pass external parameters to the stylesheet. When performing transformations, it is sometimes necessary to pass variable values from one template to another. This is particularly useful if you are using a named template to transform different XML trees. Similarly, it is also possible to modify the way a template behaves based on the value(s) set by an external parameter control stream. The parameter control stream can be of any type. The syntax for parameters in the control stream is ParameterName="value", for example Indent="Right".
Additional Information
 
Note that the option to use parameter control tags is only available with the LibXML parser.
Perl Script transformations
The following option calls a Perl script to transform the input stream. The specified input, output and parameter streams are opened and close for use by the Perl script by default.
The default names for the streams and associated file handles are:
open IN, "<$inputStream";
open OUT, ">$outputStream";
open PARAM,"<$paramStream";
The code that gets run before the Perl control script is located in string 1475 and the code run at the end is in string 1476.
For more information, see Reference Chapter: XSLT in PTC ALD and Reference Chapter: XML in PTC ALD.