Imported Upstream version 1.79.2
[platform/upstream/docbook-xsl-stylesheets.git] / fo / axf.xsl
1 <?xml version='1.0'?>
2 <xsl:stylesheet exclude-result-prefixes="d"
3                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4                 xmlns:d="http://docbook.org/ns/docbook"
5                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
6                 xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
7                 version='1.0'>
8
9 <xsl:template name="axf-document-information">
10
11     <xsl:variable name="authors" select="(//d:author|//d:editor|
12                                           //d:corpauthor|//d:authorgroup)[1]"/>
13     <xsl:if test="$authors">
14       <xsl:variable name="author">
15         <xsl:choose>
16           <xsl:when test="$authors[self::d:authorgroup]">
17             <xsl:call-template name="person.name.list">
18               <xsl:with-param name="person.list" 
19                  select="$authors/*[self::d:author|self::d:corpauthor|
20                                self::d:othercredit|self::d:editor]"/>
21             </xsl:call-template>
22           </xsl:when>
23           <xsl:when test="$authors[self::d:corpauthor]">
24             <xsl:value-of select="$authors"/>
25           </xsl:when>
26            <xsl:when test="$authors[d:orgname]">
27             <xsl:value-of select="$authors/d:orgname"/>
28           </xsl:when>
29           <xsl:otherwise>
30             <xsl:call-template name="person.name">
31               <xsl:with-param name="node" select="$authors"/>
32             </xsl:call-template>
33           </xsl:otherwise>
34         </xsl:choose>
35       </xsl:variable>
36
37       <xsl:element name="axf:document-info">
38         <xsl:attribute name="name">author</xsl:attribute>
39         <xsl:attribute name="value">
40           <xsl:value-of select="normalize-space($author)"/>
41         </xsl:attribute>
42       </xsl:element>
43     </xsl:if>
44
45     <xsl:variable name="title">
46       <xsl:apply-templates select="/*[1]" mode="label.markup"/>
47       <xsl:apply-templates select="/*[1]" mode="title.markup"/>
48     </xsl:variable>
49
50     <!-- * see bug report #1465301 - mzjn -->
51     <axf:document-info name="title">
52       <xsl:attribute name="value">
53         <xsl:value-of select="normalize-space($title)"/>
54       </xsl:attribute>
55     </axf:document-info>
56
57     <xsl:if test="//d:keyword">
58       <xsl:element name="axf:document-info">
59         <xsl:attribute name="name">keywords</xsl:attribute>
60         <xsl:attribute name="value">
61           <xsl:for-each select="//d:keyword">
62             <xsl:value-of select="normalize-space(.)"/>
63             <xsl:if test="position() != last()">
64               <xsl:text>, </xsl:text>
65             </xsl:if>
66           </xsl:for-each>
67         </xsl:attribute>
68       </xsl:element>
69     </xsl:if>
70
71     <xsl:if test="//d:subjectterm">
72       <xsl:element name="axf:document-info">
73         <xsl:attribute name="name">subject</xsl:attribute>
74         <xsl:attribute name="value">
75           <xsl:for-each select="//d:subjectterm">
76             <xsl:value-of select="normalize-space(.)"/>
77             <xsl:if test="position() != last()">
78               <xsl:text>, </xsl:text>
79             </xsl:if>
80           </xsl:for-each>
81         </xsl:attribute>
82       </xsl:element>
83     </xsl:if>
84
85 </xsl:template>
86
87 <!-- These properties are added to fo:simple-page-master -->
88 <xsl:template name="axf-page-master-properties">
89   <xsl:param name="page.master" select="''"/>
90
91   <xsl:if test="$crop.marks != 0">
92     <xsl:attribute name="axf:printer-marks">crop</xsl:attribute>
93     <xsl:attribute name="axf:bleed"><xsl:value-of
94                           select="$crop.mark.bleed"/></xsl:attribute>
95     <xsl:attribute name="axf:printer-marks-line-width"><xsl:value-of
96                           select="$crop.mark.width"/></xsl:attribute>
97     <xsl:attribute name="axf:crop-offset"><xsl:value-of
98                           select="$crop.mark.offset"/></xsl:attribute>
99   </xsl:if>
100
101   <xsl:call-template name="user-axf-page-master-properties">
102     <xsl:with-param name="page.master" select="$page.master"/>
103   </xsl:call-template>
104
105 </xsl:template>
106
107 <xsl:template name="user-axf-page-master-properties">
108   <xsl:param name="page.master" select="''"/>
109 </xsl:template>
110
111 </xsl:stylesheet>