Skip to content

Use an XSLT to Render the Details Page

Christine White edited this page Sep 6, 2013 · 3 revisions

This customization assumes familiarity with two topics:

When a user clicks the "Details" link for a resource in the geoportal, the geoportal displays the resource's metadata in a human readable format, typically defined by the parameters in the corresponding definition.xml file. For example, if the metadata document adheres to the FGDC metadata standard, the geoportal will use the fgdc-definition.xml file from the \\geoportal\WEB-INF\classes\gpt\metadata\fgdc directory to render what the user sees on the Details page. Any 'parameter' defined in the definition file that also occurs in the raw metadata XML will be displayed on the Details page. If a metadata element is present in the XML but not defined by a 'parameter' in the definition file, then it will not be displayed.

Another way to render the Details page is to use a custom xsl or xslt. The benefit of using an xslt is that all of the information present in the metadata document can be displayed in the Details page without having foreknowledge of what elements will be included in the metadata.

Steps

  • To enable referencing an xslt, your organization must first have an xslt that can be referenced (note: some sample xslts are available online; these can be used as a base but will likely need some adjustment for use with your geoportal).
    • Tip: The geoportal Details page automatically renders a Title for the page. If your xslt also leverages the metadata's title as an element for display, you may see the title rendered twice on the Details page. Also, the geoportal will consume the xslt within its Details page. This means that if your xslt uses its own styles, they could override the geoportal styling on the page unless the xslt's styles are defined by unique names. For example, if the styles use common names such as body, a:link, a:active, a:visited, a:hover, etc., these will overwrite the styling with the same reference in the geoportal's main.css. For more information on styling in the Geoportal, see Geoportal User Interface Components.
  • Once you've identified an xslt to use, copy it to a location accessible to your geoportal web application. For example, you can copy it to the same directory as your definition.xml files.
  • To reference the xslt, open the definition.xml file for which you want to associate the xslt. Find the <schema></schema> tag. After the templateFile attribute, add a new attribute called detailsXslt.
  • Set the detailsXslt attribute to reference the filepath to your xslt. See an example for the fgdc-definition.xml file below that references an xslt called FGDC_Classic.xsl.
<schema key="fgdcbio" 
 templateFile="gpt/metadata/fgdc/fgdc-template.xml" 
 detailsXslt="gpt/metadata/fgdc/xslt/FGDC_Classic.xsl">
  • After making the change, save the definition.xml file and restart your geoportal application.
Now when you view metadata document's that would reference that are rendered by that definition.xml file, you should see the Details page rendered as defined in your xslt.
Back to Customizations
Clone this wiki locally