XSL Transformation

Know what is XSLT transformation in FrameMaker.

FrameMaker provides options for processing XML. FrameMaker also allows XML import and export to support XSL transformations, and the Schema language for grammar and rule definition (see XML with schema). You can import an XML document that uses schema, automatically creating a Document Type Definition (DTD) from the referenced schema, or you can create an Element Definition Document (EDD) directly from a schema definition. You can also validate against an associated schema upon both import and export.

XSL (EXtensible Stylesheet Language) is a style sheet language for XML documents. XSLT (Extensible Stylesheet Language Transformation) is the means by which transformations defined in XSL are applied to XML documents.

XSL is a set of the following three specifications:
XSLT

A language for transforming XML documents.

XPath

A language for navigating in XML documents.

XSL-FO

A language for formatting XML documents.

FrameMaker includes an XSLT processor that allows you to associate an XSLT file with an XML structure application or XML document, and apply the transformations defined in that document when importing from or exporting to XML. FrameMaker supports W3C XSLT 3.0 recommendations. You can change the XSLT processor by editing the maker.ini file or from within your structured application.

Upon import, XSL transformations are applied before the default read rules or any additional read rules you have defined. That is, the result of applying an XSL transformation on import is a new file, which (if it is an XML file) is passed to the read/write rules.

Upon export, XSL transformations are applied after the default or explicit write rules. The result of applying read/write rules on export is a new XML file, which, if it is valid, is passed to the XSLT processor.

You can create a hypertext output (XML or HTML) from an XML file using an XSL. You can create and save reusable transformations in an XML file. The reusable transformations include information such as the name and path of the XSLT and the path of the input and output files.

The output is created using a parser installed on the machine and registered with FrameMaker through maker.ini settings. XALAN and SAXON are installed by default on your machine with FrameMaker. XALAN supports XSLT 1.0 and SAXON supports XSLT 3.0. Both XALAN and SAXON are JAXP compliant.

Note: FrameMaker (2019 release) is shipped with Saxon Enterprise Edition 9.8.3.

SAXON is the default parser used when XSL is run directly or no transformation-specific parser is specified. However, you can specify a new default processor in the maker.ini file using the following flags:

[XSLTProcessors] 
; processorName=jar path(all dependent jars should be in same dir), TransformerFactory class,
; default if default processor
; (if not specified - 1st processor would become default.)
XALAN=fminit\XSLT\XSLTProcessors\xalan\xalan-j_2_7_2-bin\xalan.jar, 
  org.apache.xalan.processor.TransformerFactoryImpl
SAXON=fminit\XSLT\XSLTProcessors\saxon\SaxonEE9-8-0-7J\saxon9ee.jar, 
  net.sf.saxon.TransformerFactoryImpl, Default

An XSL transformation includes information such as XSL, Parser, and Output folder, to create an output from XML files. The transformation that you create are stored in an XML file. There are two types of transformations: default and application-specific. The default transformations are stored in the file as specified in the maker.ini file using the TransformationFilePath flag. The application-specific transformations are stored in an XML file that you specify for the structured application in the structapps.fm file.

The XSLT toolbar maintains a history of the transformations you use and lets you use Advanced Run feature to create output from multiple XML files. From the toolbar, you can also choose and run a transformation\XSL on the open file. For more information, see Transform multiple files using Advanced Run.


XSLT toolbar in FrameMaker

A. Click to select an XSL file B. Click to select a transformation C. Run the selected transformation or XSL D. Click to display the Advanced Run dialog

Switch to XALAN processor

  1. In the maker.in file, locate the XSLTProcessors section.

  2. The entry for the SAXON processor has the suffix: Default.

    XALAN=fminit\XSLT\XSLTProcessors\xalan\xalan-j_2_7_2-bin\xalan.jar, 
       org.apache.xalan.processor.TransformerFactoryImpl
    SAXON=fminit\XSLT\XSLTProcessors\saxon\SaxonEE9-8-0-7J\saxon9ee.jar,
       net.sf.saxon.TransformerFactoryImpl, Default
  3. Cut and paste to shift the suffix to the XALAN processor’s entry as following:

    XALAN=fminit\XSLT\XSLTProcessors\xalan\xalan-j_2_7_2-bin\xalan.jar, 
       org.apache.xalan.processor.TransformerFactoryImpl, Default
    SAXON=fminit\XSLT\XSLTProcessors\saxon\SaxonEE9-8-0-7J\saxon9ee.jar,
       net.sf.saxon.TransformerFactoryImpl

Create transformations

Learn to create XSLT transformations in FrameMaker.

Note: Ensure that you switch to the XML View before performing this procedure.
  1. Select XSLT > Manage Transformation.


    Manage Transformation dialog in the XML View of FrameMaker

  2. In the Manage Transformations dialog:

    To use the default transformation file, select Default Transformation File and then click New.

    To create a new transformation file, select Transformation File, click New.

    Note: If you already have an existing transformation file, click Browse and select it.
  3. Click New.

  4. In the New Transformation dialog, specify the following information and click Save As to create a transformation file:

    Note: If you selected an existing transformation file in Step 1 using Browse button, save the new transformation in the selected transformation file.
    1. Transformation Name: A name for the transformation setting.

    2. Use: Either select an XSL file or choose to use the processing instructions (PI) inside the XML file.

    3. Processor: SAXON, XALAN, or any other parser registered with FrameMaker.

    4. Output: Settings related to the output file, such as location to save, suffix, and how to open the output file.

Edit transformations

Learn how to associate the transformation files to your XML application in FrameMaker.

Once you have created a transformation, you can associate the transformation file to one or more XML applications in structapps.fm.

  1. In the WYSIWYG view, select Structure > Application Definition > Edit Global Application Definitions.

  2. In a structured application, locate the <TransformationFile> element and specify the path and name of the transformations file.


    Locating the Transformation File element and specifying the path and name of the transformations file in the Structure View

  3. Save the StructApps.fm file and select Structure > Application Definition > Read Application Definitions.

Now, you can choose to generate file output with the relevant application transformation.

Application-specific transformation

See how you can work with Application-specific transformations in FrameMaker.

  1. With an XML file in focus in XML View, in the XSLT toolbar select Transformation from the Choose drop-down.

  2. In the Choose Transformations dialog, select Structured Applications.


    Application-specific transformation in the Manage Transformation dialog

  3. The relevant application, as specified in structapps.fm, is selected from the drop-down list and the relevant transformations appear in the Transformations field.

  4. In Transformations, select the transformation using which you want to generate the output and click OK.

  5. In the XSLT toolbar, click Run.

    FrameMaker generates the hypertext output and displays the file.

Transform multiple files using Advanced Run

See how you can use advanced run to transformation on multiple XML files in FrameMaker.

Using the XSLT toolbar, you can run a transformation on multiple files.

  1. In the XSLT toolbar, select Advanced Run.

    Advanced Run in the XSLT toolbar

  2. In the Advanced Run dialog, select a scope for running the transformation:

    1. Current File: Generate output from the XML file open in FrameMaker.

    2. Select Include Child Elements if the active document is a book or a map. When this option is selected, the XSLT is applied to the child elements, together with the parent element.

    3. All Open Files: Generate output from all the XML files open in FrameMaker using a transformation transformations or XSL.

    4. Folder: Generate output from all the XML files in a folder using a transformation or XSL. Select Include Sub-Folders, if necessary.

  3. Select a transformation or XSL and click Run.

The output files are launched in the associated application.


April 29, 2020

Legal Notices | Online Privacy Policy