source: Document_handling/trunk/XSLT/convert_DIF_ids_jamies.xsl @ 246

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/Document_handling/trunk/XSLT/convert_DIF_ids_jamies.xsl@246
Revision 246, 1.4 KB checked in by selatham, 15 years ago (diff)

various new scripts

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- A one-off to convert ids in BADC DIFs.
3        Note: only to be used for BADC records. Specofocally for Jamie's DIF outputs which were slightly different.
4 -->
5<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
6        <xsl:output method="xml" encoding="UTF-8"  indent="yes" />
7       
8      <xsl:template match="/">
9                <xsl:apply-templates/>
10        </xsl:template>
11       
12        <!-- This is the main template-->
13        <xsl:template match="DIF">
14                <xsl:copy>
15                        <xsl:apply-templates select="@*|node()"/>
16                </xsl:copy>
17        </xsl:template>
18       
19        <xsl:template match="@*|node()">
20                <xsl:copy>
21                        <xsl:apply-templates select="@*|node()"/>
22                </xsl:copy>
23        </xsl:template>
24       
25        <xsl:template match="Entry_ID">
26                        <xsl:variable name="localID" select="substring-after(.,'/') "></xsl:variable>
27                        <xsl:variable name="repositoryID" select="substring-before(.,'/')"></xsl:variable>
28                        <Entry_ID><xsl:value-of select="concat($repositoryID,':', 'DIF',':', $localID)"/>
29                        </Entry_ID>
30        </xsl:template>   
31
32        <xsl:template match="Data_Set_ID">
33                        <xsl:variable name="localID" select="substring-after(substring-after(.,'/'),'/') "></xsl:variable>
34                        <xsl:variable name="repositoryID" select="substring-before(substring-after(.,'/'),'/')"></xsl:variable>
35                        <Data_Set_ID><xsl:value-of select="concat($repositoryID,':','CDML-0',':', $localID)"/>
36                        </Data_Set_ID>
37        </xsl:template>   
38
39
40
41</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.