XSLT Transformation (Conversion)


Uses the .NET 3.5 XML software to transform an ArcGIS item's metadata or any XML file using an XSLT 1.0 stylesheet and save the result to an XML file.

XSLT stylesheets can be used to perform a variety of modifications to ArcGIS metadata or an XML file. Several XSLT stylesheets are provided with ArcGIS. Some transform metadata into HTML pages for display. Others are used by the metadata model geoprocessing tools to perform portions of the importing, exporting, and upgrading metadata processes, or can be used to perform well-known metadata tasks. They can be found in the <ArcGIS Install Location>\Metadata\Stylesheets folder.

You can create your own XSLT stylesheets to perform tasks using the provided stylesheets as examples. For example, you might write a stylesheet to:

XSLT stylesheets that modify ArcGIS metadata should not remove information in the Esri and Binary metadata elements except if the output XML will be used outside of ArcGIS.



XSLTransform_conversion (source, xslt, output, {xsltparam})
ParameterExplanationData Type

The item whose metadata will be converted or a stand-alone XML file that will be converted.

Data Element; Layer

An W3C-compliant XSLT 1.0 stylesheet file that defines the transformation that will be performed.


A file that will be created containing the converted metadata.

The type of file created depends on the output method specified in the XSLT stylesheet.


An XML file or string that will be passed to the XSLT stylesheet.

To capture this parameter in the XSLT stylesheet, add <xsl:param name="gpparam" /> to the top of the XSLT stylesheet after the xsl:output element and before the first xsl:template element. See merge upgraded FGDC with existing.xslt for an example.

File; String

Code Sample

Export metadata to an HTML file

Uses the ArcGIS.xsl XSLT stylesheet provided with ArcGIS to export metadata to an HTML file for use in a Web site.

import arcpy
from arcpy import env
env.workspace = "C:/data"
#set local variables
dir = arcpy.GetInstallInfo("desktop")["InstallDir"]
xslt = dir + "Metadata/Stylesheets/ArcGIS.xsl"
arcpy.XSLTransform_conversion("vegetation", xslt, "vegetation.html", "#")


Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes