Changes between Version 16 and Version 17 of extractSubtemplates


Ignore:
Timestamp:
May 8, 2012, 8:04:55 PM (12 years ago)
Author:
simonp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • extractSubtemplates

    v16 v17  
    7979}}}
    8080
    81  * Identify a field or fields within the fragment that will be used as the title of the subtemplate. It is important to choose a set of fields that will allow a human to identify the subtemplate when they choose to either reuse the subtemplate in a new record or edit in the subtemplate directories interface (see below).
    82  * Write a small XSLT that when applied to the fragment, will extract the title information. As an example, here is an XSLT that when applied to an ISO19135 register item (gnreg:RE_RegisterItem), will extract the name of the register item (grg:name/gco:CharacterString) for use as the title of the subtemplate.
    83 
    84 {{{
    85 <?xml version="1.0" encoding="UTF-8"?>
    86 
    87 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    88             xmlns:gco="http://www.isotc211.org/2005/gco"
    89             xmlns:grg="http://www.isotc211.org/2005/grg"
    90             xmlns:gnreg="http://geonetwork-opensource.org/register"
    91             xmlns:gmd="http://www.isotc211.org/2005/gmd">
    92 
    93   <xsl:template match="gnreg:RE_RegisterItem">
    94     <title><xsl:value-of select="grg:name/gco:CharacterString"/></title>
    95   </xsl:template>
    96 
    97 </xsl:stylesheet>
    98 }}}
    99 
     81 * Identify and record the XPath of a field or fields within the fragment whose text content will be used as the title of the subtemplate. It is important to choose a set of fields that will allow a human to identify the subtemplate when they choose to either reuse the subtemplate in a new record or edit in the subtemplate directories interface (see below).
    10082 * In !GeoNetwork main page, search for and then select the records from which the subtemplates will be extracted. See the following example:
    10183
     
    10385
    10486 * Choose 'Extract subtemplates' from the 'Actions on selected set' drop down menu at the top right of the search interface.
    105  * Enter the XPath of the fragment, server side path name of the XSLT to extract a title for the subtemplate to be created from the fragment and a category to which the new subtemplates will be assigned. See the following example:
     87 * Enter the XPath of the fragment, XPath of the element(s) in the fragment to extract a title for the subtemplate to be created from the fragment and a category to which the new subtemplates will be assigned. See the following example:
    10688
    10789[[Image(extract-subtemplates.png)]]
    10890
    109  * Run the command and check the logs to see whether your XPath and title extraction XSLT are doing what you expect.
     91 * Run the command and look at the test results that are displayed (see example following) to see whether the XPath and title extraction XPath are doing what you expect. If you scroll down, the test results show: XPath of fragment, number of subtemplates that will be created, first subtemplate extracted, title extracted from subtemplate and the xlink element that will replace the fragment in the metadata record. No changes are made to the metadata records.
     92
     93[[Image(extract-subtemplates-testresults.png)]]
     94
    11095 * Check the checkbox alongside the 'I really want to do this!' when you're sure that everything is ok. The end result will be that the fragments of metadata specified by the XPath will be removed from the records in the selected set and saved as subtemplates and then linked into the records that use them. Here is what part of the register record example used here looks like with an XLink replacing the original gnreg:RE_RegisterItem:
    11196