XSLT transformations can be used to perform various processes on an item's metadata, including saving a copy of an item's metadata to an XML file, saving a copy of the metadata display to an HTML file, and changing an item's metadata content.
XSLT (Extensible Stylesheet Language Transformations) is a language that can be used to transform an XML document into another XML document. XSLT can also format an XML document's content to produce output such as an HTML page or a text file. ArcGIS Desktop provides access to an item's metadata as an XML document. Therefore, one way to process an item's metadata is with an XSLT that accomplishes the task. XML files and metadata can be processed in ArcGIS Desktop using the XSLT Transformation tool. XSLT has been a W3C specification since 1999.
Several XSLT stylesheets are provided with ArcGIS Desktop. These stylesheets are described in the tables below. You can also create custom XSLT stylesheets that can be used to process an item's metadata.
Save As HTML file
The following stylesheets produce HTML documents used to display an item's metadata in the Description tab. They extract content from an item's metadata and add HTML formatting instructions.
You might incorporate the resulting HTML files into a website, and update them periodically using a script that runs at scheduled intervals. These stylesheets are optimized to provide a nice metadata using the browser control used by ArcGIS Desktop; the resulting HTML may not have the same appearance in another browser. If you're interested in creating custom stylesheets for display, you can learn more by reading the documentation provided with the ArcGIS Metadata Toolkit.
These stylesheets can be found in the <ArcGIS Installation Location>\Metadata\Stylesheets folder. They should not be copied or shared on their own. They import the contents of several files in the ArcGIS_Imports folder, which perform most of the processing tasks.
ArcGIS.xsl | Displays an item's complete metadata content. It is referenced by all metadata styles except the default Item Description style. |
ArcGIS_ItemDescription.xsl | Displays only a concise description of the item. It is referenced by the default Item Description metadata style. |
- Open the XSLT Transformation tool.
- Set the Input XSLT parameter to the path of one of the XSLT stylesheets above.
- Set the Output File parameter to a file with the extension .html.
- Run the tool.
Save As XML file
The following stylesheets can be used to save the item's metadata as an XML file. One lets you save an exact copy of the original metadata XML document. The others remove different levels of sensitive information from an item's metadata and save the result as an XML file. For example, if you were going to share an item's metadata with the public, you may want to remove information about computer, database, and user names from the metadata first. You could create a model or script that runs this process, then sends the resulting XML file to the Export Metadata tool. These stylesheets can be found in the <ArcGIS Installation Location>\Metadata\Stylesheets\gpTools folder.
exact copy of.xslt | Creates an exact copy of the item's metadata as an XML file. For example, you might use this stylesheet to save a copy of a geodatabase item's metadata to a local file so it can be examined. |
remove local storage info.xslt | Removes any machine names that may exist in the item's metadata. Depending on where the machine name was found or its context, different actions will be taken. The metadata element containing the information will be removed, or the machine name will be removed from the UNC path it resides in, or the metadata element's value will be changed to identify the location as withheld. This XSLT is used before packaging an item's metadata. |
remove local storage info strict.xslt | Removes the same information as remove local storage info.xslt, but removes all file paths that are not provided as a URL. Operating system information, database types, and geoprocessing history are removed; geoprocessing history consists largely of file paths and database connection information. This XSLT is used to process a map's metadata before publishing it as a service. |
- Open the XSLT Transformation tool.
- Set the Input XSLT parameter to the path of one of the XSLT stylesheets above.
- Set the Output File parameter to a file with the extension .xml.
- Run the tool.
Save As a template
The following stylesheet can be used to save the item's metadata as an XML file that can be used as a metadata template. Content that specifically describes the original item is removed. This stylesheet is in the <ArcGIS Installation Location>\Metadata\Stylesheets\gpTools folder.
generate metadata template.xslt | Copies ArcGIS metadata content to a new XML file that can be imported to other items as a metadata template. Synchronized metadata content is excluded from the template and any empty elements are removed. |
- Open the XSLT Transformation tool.
- Set the Input XSLT parameter to the path of one of the XSLT stylesheets above.
- Set the Output File parameter to a file with the extension .xml.
- Run the tool.
Update metadata
The following stylesheets can be used to make changes to an item's metadata. One of the XSLTs below can be used to process an item's metadata, making a specific change, then save the result as an XML file. Save the result back to the item using the Metadata Importer tool, which replaces the item's original metadata with the modified content. A model or script can be created that performs these tasks together.
Alternatively, these processes might be intermediate steps in a larger series of changes. For example, a process could update a unique identifier remove an item's geoprocessing history, remove any machine names from the metadata content, then save the updated metadata to a stand-alone metadata XML file before publishing it to a metadata catalog.
These stylesheets can be found in the <ArcGIS Installation Location>\Metadata\Stylesheets\gpTools folder.
add unique identifier.xslt | Adds or changes the unique identifier stored in the item's metadata. The identifier modified by this stylesheet is stored in the Esri PublishedDocID metadata element and is used to identify the document in a metadata catalog such as a Geoportal. |
remove geoprocessing history.xslt | Removes an item's geoprocessing history. While all of the metadata geoprocessing tools are designed to preserve an item's geoprocessing history, over time, that history can grow so large that the item's metadata becomes difficult to handle as an XML document. In these circumstances it may be necessary to remove an item's geoprocessing history. |
remove pre94 metadata elements.xslt | Removes any ESRI-ISO format XML elements and any FGDC CSDGM-format XML elements from an item's metadata that are not included in the ArcGIS metadata format. |
remove thumbnail.xslt | Removes an item's thumbnail. While all of the metadata geoprocessing tools are designed to preserve an item's thumbnail, in some circumstances, you might want to remove the item's thumbnail. You can remove one item's thumbnail when you edit its metadata in the Description tab. With this script, you could run a batch process to remove thumbnails from many items. |
You can create your own XSLT stylesheets to update metadata using the provided stylesheets as examples. For example, you might write a stylesheet to update addresses or phone numbers. XSLT stylesheets that update ArcGIS metadata should not remove content from the Esri and Binary metadata elements.
- Create a model or script that first processes an item's metadata using the XSLT Transformation tool, then uses the Metadata Importer tool to save the updated XML file back to the item.
- Set the XSLT Transformation tool's Source Metadata parameter as a parameter for the model or script.
- Set the Input XSLT parameter to the path of one of the XSLT stylesheets above.
- Run the tool.
Processes used by other tools
Several of the stylesheets available in the <ArcGIS Installation Location>\Metadata\Stylesheets\gpTools folder perform intermediate steps essential to the operation of the Export Metadata, Import Metadata, and Upgrade Metadata tools. These stylesheets are not typically used individually. However, their processes are described here so they can be used as examples.
merge imported metadata with existing.xslt | Replaces existing ArcGIS metadata content with the imported ArcGIS metadata content in the item's metadata. The item's original thumbnail, geoprocessing history, and some of the item's properties are left intact. Used by the Import Metadata tool. |
merge upgraded FGDC with existing.xslt | Replaces any existing ArcGIS metadata content with the ArcGIS metadata content produced by upgrading the item's original CSDGM-format metadata. The item's original thumbnail, geoprocessing history, and some of the item's properties are left intact. Used by the Upgrade Metadata tool. |
prep metadata for export.xslt | Prepares metadata to be exported. Transfers specified entries in the geoprocessing history to the item's official lineage process steps. Handles raster item properties appropriately for the raster's type. Removes HTML formatting from elements that appear on the Item Description page in the metadata editor. Used by the Export Metadata tool. |
remove empty elements.xslt | Removes empty XML elements. After other stylesheets have been used to remove unwanted metadata content, empty XML elements may remain. Empty XML elements can cause problems if you later try to validate an item's metadata. For example, if an element is optional but empty, you will often receive an error message because the element has no value, whereas the metadata would be valid if the empty element was removed. Used by the Import Metadata and Upgrade Metadata tools. |
remove FGDC required hints.xslt | Removes any FGDC CSDGM-format metadata elements that contain the text REQUIRED. These text strings were added by ArcGIS Desktop 9.3.1 when metadata was created to indicate which elements are required to create valid FGDC CSDGM-format metadata. However, these strings can cause problems when you validate an item's metadata. When the default text is present, the element is considered valid because it contains text, even though the text doesn't provide any information about the item. Default text strings are not added by the current version of ArcGIS, and these strings are not upgraded to the ArcGIS metadata format along with the rest of an item's metadata content. Used by the Upgrade Metadata tool. |
remove synchronized elements.xslt | Removes any information that was added to an item's metadata by the ArcGIS metadata synchronization process. Previously-synchronized content is not imported or upgraded. After the import or upgrade process, the metadata is synchronized, and properties reflecting the item's current state are recorded in its metadata. Used by the Import Metadata and Upgrade Metadata tools. |
remove unique identifiers.xslt | Removes all unique identifiers from an item's metadata before importing the content. The removed identifiers include those added automatically by ArcGIS and those provided using a metadata editor. Identifiers should never be copied to another item; they should uniquely describe a resource. If a dataset was provided with metadata in another format that must be imported, transfer its identifier manually to the item's metadata by pasting it into the ArcGIS metadata editor on the Details page under the Metadata heading. Used by the Import Metadata tool. |
upgrade ESRI-ISO to ArcGIS94.xslt | Upgrades an item's existing ESRI-ISO-format metadata created in ArcGIS Desktop 9.3.1 with the ISO Metadata Editor wizard to the ArcGIS metadata format. Used by the Upgrade Metadata tool. |
Processes specific to CSDGM-formatted metadata content
Some XSLT stylesheets provided with earlier versions of ArcGIS to process FGDC CSDGM-formatted metadata that continues to be available in an item's metadata—this is the information displayed under the FGDC Metadata (read-only) heading in the Description tab. The current version of ArcGIS doesn't use FGDC CSDGM-formatted metadata. However, these stylesheets can be used with the XSLT transformation tool to process CSDGM-format metadata if they are needed.
_MPXML2.xsl | Extracts any FGDC CSDGM-format metadata elements that may be present in an item's metadata, and orders them correctly. For example, this content could have been created using ArcGIS Desktop 9.3.1. The resulting XML document can be validated with an FGDC CSDGM XML schema or with the metadata parser utility, mp, using the USGS MP Metadata Translator tool. This file can be found in the <ArcGIS Installation Location>\Metadata\Stylesheets folder. |
remove entries from FGDC lineage.xslt | Removes unwanted process steps from any FGDC CSDGM-format lineage information that may be present in the item's metadata. Process steps were added to the CSDGM-format lineage by ArcGIS Desktop 9.3.1 when metadata was imported and when the item was copied to a new location. These operations can occur frequently, and the entries can obscure more significant processing steps in the item's lineage. These entries are not added to an item's lineage by the current version of ArcGIS and are not included when the rest of the item's lineage is upgraded to the ArcGIS metadata format. This file can be found in the <ArcGIS Installation Location>\Metadata\Stylesheets\gpTools folder. |