Revision 5795
Added by Jing Tao almost 14 years ago
lib/style/common/util.xsl | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<!-- |
|
3 |
* '$RCSfile$' |
|
4 |
* Authors: Matt Jones, CHad Berkley |
|
5 |
* Copyright: 2009 Regents of the University of California and the |
|
6 |
* National Center for Ecological Analysis and Synthesis |
|
7 |
* For Details: http://www.nceas.ucsb.edu/ |
|
8 |
* |
|
9 |
* '$Author: leinfelder $' |
|
10 |
* '$Date: 2009-04-02 14:20:05 -0800 (Thu, 02 Apr 2009) $' |
|
11 |
* '$Revision: 4893 $' |
|
12 |
* |
|
13 |
* This program is free software; you can redistribute it and/or modify |
|
14 |
* it under the terms of the GNU General Public License as published by |
|
15 |
* the Free Software Foundation; either version 2 of the License, or |
|
16 |
* (at your option) any later version. |
|
17 |
* |
|
18 |
* This program is distributed in the hope that it will be useful, |
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
* GNU General Public License for more details. |
|
22 |
* |
|
23 |
* You should have received a copy of the GNU General Public License |
|
24 |
* along with this program; if not, write to the Free Software |
|
25 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
26 |
* |
|
27 |
* This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to |
|
28 |
* convert an XML file showing the resultset of a query |
|
29 |
* into an HTML format suitable for rendering with modern web browsers. |
|
30 |
--> |
|
31 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
|
32 |
<xsl:output method="html" /> |
|
33 |
<xsl:variable name ="colon" select="':'"/> |
|
34 |
<xsl:variable name ="dot" select="'.'"/> |
|
35 |
|
|
36 |
<!--Template to extract docid from lsid string. The last three parts of lisd (separated by colon) are docid--> |
|
37 |
<xsl:template name="extractDocidFromLsid"> |
|
38 |
<xsl:param name="lsidString" /> |
|
39 |
<xsl:choose> |
|
40 |
<xsl:when test="contains($lsidString,$colon)"> |
|
41 |
<xsl:variable name="subString" select="substring-after($lsidString,$colon)" /> |
|
42 |
<xsl:choose> |
|
43 |
<xsl:when test="contains($subString,$colon)"> |
|
44 |
<xsl:variable name="subString2" select="substring-after($subString,$colon)" /> |
|
45 |
<xsl:choose> |
|
46 |
<xsl:when test="contains($subString2,$colon)"> |
|
47 |
<xsl:call-template name="extractDocidFromLsid"> |
|
48 |
<xsl:with-param name="lsidString" select="$subString" /> |
|
49 |
</xsl:call-template> |
|
50 |
</xsl:when> |
|
51 |
<xsl:otherwise> |
|
52 |
<xsl:variable name="docidWithoutEmptyString" select='normalize-space($lsidString)'/> |
|
53 |
<xsl:value-of select='translate($docidWithoutEmptyString, $colon, $dot)' /> |
|
54 |
<!--<xsl:value-of select="$lsidString" />--> |
|
55 |
</xsl:otherwise> |
|
56 |
</xsl:choose> |
|
57 |
</xsl:when> |
|
58 |
</xsl:choose> |
|
59 |
</xsl:when> |
|
60 |
</xsl:choose> |
|
61 |
</xsl:template> |
|
62 |
</xsl:stylesheet> |
Also available in: Unified diff
Add the util.xsl which will be reused by another xsl files.