Statistics
| Revision:

root / tmp / org.txm.core / res / org / txm / xml / xsl / tei / odt / listgraphics.xsl @ 187

History | View | Annotate | Download (3.3 kB)

1
<?xml version="1.0" encoding="utf-8"?>
2
<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0"
3
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
                version="2.0">
5
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
6
      <desc>
7
         <p> TEI stylesheet dealing with elements from the core module. </p>
8
         <p>This software is dual-licensed:
9

    
10
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
11
Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
12

    
13
2. http://www.opensource.org/licenses/BSD-2-Clause
14
		
15
All rights reserved.
16

    
17
Redistribution and use in source and binary forms, with or without
18
modification, are permitted provided that the following conditions are
19
met:
20

    
21
* Redistributions of source code must retain the above copyright
22
notice, this list of conditions and the following disclaimer.
23

    
24
* Redistributions in binary form must reproduce the above copyright
25
notice, this list of conditions and the following disclaimer in the
26
documentation and/or other materials provided with the distribution.
27

    
28
This software is provided by the copyright holders and contributors
29
"as is" and any express or implied warranties, including, but not
30
limited to, the implied warranties of merchantability and fitness for
31
a particular purpose are disclaimed. In no event shall the copyright
32
holder or contributors be liable for any direct, indirect, incidental,
33
special, exemplary, or consequential damages (including, but not
34
limited to, procurement of substitute goods or services; loss of use,
35
data, or profits; or business interruption) however caused and on any
36
theory of liability, whether in contract, strict liability, or tort
37
(including negligence or otherwise) arising in any way out of the use
38
of this software, even if advised of the possibility of such damage.
39
</p>
40
         <p>Author: See AUTHORS</p>
41
         <p>Id: $Id: listgraphics.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
42
         <p>Copyright: 2008, TEI Consortium</p>
43
      </desc>
44
   </doc>
45

    
46
  <xsl:output method="text"/>
47
  <xsl:param name="DIR"/>
48
  <xsl:param name="ORIG">.</xsl:param>
49

    
50
  <xsl:key match="tei:graphic|tei:pb[@facs]" use="1" name="G"/>
51

    
52
  <xsl:template match="/">
53
      <xsl:for-each select="key('G',1)">
54
         <xsl:variable name="F">
55
            <xsl:value-of select="@url|@facs"/>
56
         </xsl:variable>
57
	 <xsl:variable name="target">
58
	   <xsl:value-of select="$DIR"/>
59
	   <xsl:text>/image</xsl:text>
60
	   <xsl:if test="self::tei:pb">pb</xsl:if>
61
	   <xsl:number level="any"/>
62
	   <xsl:text>.</xsl:text>
63
	   <xsl:value-of select="tokenize($F,'\.')[last()]"/>
64
	 </xsl:variable>
65
         <xsl:choose>
66
	   <xsl:when test="starts-with($F,'http')">
67
	     <xsl:text>curl -s -o </xsl:text>
68
	     <xsl:value-of select="$target"/>
69
	     <xsl:text> </xsl:text>
70
	     <xsl:value-of select="$F"/> 
71
	   </xsl:when>
72
	   <xsl:when test="starts-with($F,'/')">
73
	     <xsl:text>cp </xsl:text>
74
	     <xsl:value-of select="$F"/> 
75
	     <xsl:text> </xsl:text>
76
	     <xsl:value-of select="$target"/>
77
	   </xsl:when>
78
	   <xsl:otherwise> 
79
	     <xsl:text>cp </xsl:text>
80
	     <xsl:value-of select="$ORIG"/>
81
	     <xsl:text>/</xsl:text>
82
	     <xsl:value-of select="$F"/> 
83
	     <xsl:text> </xsl:text>
84
	     <xsl:value-of select="$target"/>
85
	   </xsl:otherwise>
86
         </xsl:choose>
87
         <xsl:text>&#10;</xsl:text>
88
      </xsl:for-each>
89
  </xsl:template>
90
</xsl:stylesheet>