source: trunk/surname_id.xsl @ 45

Last change on this file since 45 was 33, checked in by pinsard, 17 years ago

add Id in many headers; replace bibrefnemo.xml by biblio.xml

  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1<?xml version="1.0" encoding="iso-8859-1"?>
2
3<!--
4module :
5generation de la partie "nom" de l'id
6
7update:
8$Id$
9fplod 2007-05-18T13:03:39Z aedon.locean-ipsl.upmc.fr (Darwin)
10creation
11cf http://www.dpawson.co.uk/xsl/sect2/N7998.html
12There's a trick to this:
13
14translate($x, translate($x, 'abcde', ''), '')
15
16will remove all characters except a,b,c,d, and e from your string $x.
17et String split into elements dans http://www.dpawson.co.uk/xsl/sect2/N7240.html
18http://www.dpawson.co.uk/xsl/sect2/N7240.html
19cf. http://www.dpawson.co.uk/xsl/sect2/N7240.html CRLF to BR
20-->
21
22<xsl:stylesheet
23 id="id" version="1.0"
24 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
25
26<xsl:template name="surname_id">
27 <xsl:param name="surname"/>
28 <xsl:choose>
29  <xsl:when test="contains($surname ,' ')">
30   <xsl:call-template name="space_surname" >
31    <xsl:with-param name="text" select="$surname"/>
32   </xsl:call-template>
33  </xsl:when>
34  <xsl:otherwise>
35<xsl:value-of select="translate($surname, 'abcdefghijklmnopqrstuvwxyz éèçàùëöñó', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_EECAUEONO')"/>
36  </xsl:otherwise>
37 </xsl:choose>
38</xsl:template>
39
40<xsl:template name="space_surname">
41 <xsl:param name="text"/>
42 <xsl:choose>
43   <xsl:when test="contains($text, ' ')">
44   <xsl:variable name="transform">
45<xsl:value-of select="translate(substring-before($text, ' '), 'abcdefghijklmnopqrstuvwxyz éèçàùëöñó', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_EECAUEONO')"/>
46   </xsl:variable>
47   <xsl:value-of select="$transform"/>
48     <xsl:text>_</xsl:text>
49     <xsl:call-template name="space_surname">
50       <xsl:with-param name="text" select="substring-after($text,' ')"/>
51     </xsl:call-template>
52   </xsl:when>
53   <xsl:otherwise>
54           <xsl:value-of select="translate($text, 'abcdefghijklmnopqrstuvwxyz éèçàùëöñó', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_EECAUEONO')"/>
55   </xsl:otherwise>
56 </xsl:choose>
57</xsl:template>
58</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.