Advanced XML / GML writing with Stylesheets

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2015.x

Introduction

This article is for users that have advanced expertise related to XML stylesheets. Stylesheets are one way to write XML or GML to a custom application schema. For an alternative that might be easier for non XML experts please refer to the documentation on writing GML with application schemas or XML with XMLTemplater transformer.

A stylesheet is a form of lookup to map the FME destination schema to the required GML schema. You can find useful examples in one of the FME install folders: C:\Program Files\FME\xml\esf\stylesheets

 

Applying a Stylesheet

Once created, you can specify the stylesheet to use in:

  • The APPLY_STYLESHEET keyword

http_download_1444329651431_6032.png

Above: The APPLY_STYLESHEET keyword as described in the help docs

  • The stylesheet setting in the writer parameters (in the Navigator pane in Workbench)

http_download_1444329651607_6032.png

Above: The stylesheet setting in the Navigator pane

  • With an XSLT transformer (FME2009)

http_download_1444329651806_6032.png

Above: The XSLT transformer

 

XSLTProcessor Transformer

The XSLTProcessor is a transformer that uses an XSL (eXtensible Stylesheet Language) stylesheet to transform an XML document according to the transformation rules in the XSLT. Sources (including the stylesheet) may be either a file path name or a string stored in an attribute. (Note that the transformer asks for the attribute name that stores the file path instead of the file path itself.) It is assumed that you have created (or have access to) an XSLT stylesheet that is applicable to your XML input source.

FME will automatically classify the input source as File Path or String Stream. If you choose Both, then output will result in two forms: one as a file, and another as an attribute value stored in the feature.

Note: The following parameters correspond to File Path and String Stream. You will need to specify one or the other, and both if you selected Both in Result will be stored in attribute(s) as, above.

Result File Attribute Name: Enter a filename for the output file.

Result String Attribute Name: This attribute can be an existing attribute or a new attribute that will be added to the output feature, and which contains the transformed document as a string attribute.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.