-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathlayout.xml
98 lines (90 loc) · 3.22 KB
/
layout.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en"
version="3.7.12">
<!-- create the table of contents in one pass -->
<Pageformat height="228pt" width="12cm" />
<SetGrid height="12pt" nx="10"/>
<Pagetype name="allPages" test="true()">
<Margin left="1cm" right="1cm" top="24pt" bottom="24pt"/>
<!-- The area 'text' is two rows shorter than the page so we can
place the page number at the bottom without overlapping -->
<PositioningArea name="text">
<PositioningFrame height="{sd:number-of-rows() - 2}" width="{sd:number-of-columns() }" column="1" row="1" />
</PositioningArea>
<AtPageShipout>
<!-- page number -->
<PlaceObject column="1" row="{sd:number-of-rows()}" valign="bottom" allocate="no">
<Table stretch="max">
<Tr>
<Td align="{if (sd:even(sd:current-page())) then 'left' else 'right'}">
<Paragraph>
<Value select="sd:current-page()" />
</Paragraph>
</Td>
</Tr>
</Table>
</PlaceObject>
</AtPageShipout>
</Pagetype>
<Record element="chapter">
<!-- This is like an array. The variables will be
chapter1title, chapter1page, chapter2title, chapter2page etc.
-->
<SetVariable variable="chapter{position()}title" select="@title" />
<SetVariable variable="chapter{position()}page" select="sd:current-page()" />
<Output area="text" row="1">
<Text>
<Paragraph>
<B>
<Value select="@title" />
</B>
<Action>
<Mark select="concat('chapter',position())" pdftarget="yes" />
</Action>
</Paragraph>
<Loop select="@paragraphs">
<Paragraph>
<Value select="sd:dummytext()" />
</Paragraph>
</Loop>
</Text>
</Output>
<ClearPage />
</Record>
<Record element="data">
<!-- The table of contents will be inserted here and is one page long
To use this mechanism of “future pages”, we need to know this in advance.
Otherwise the page numbers will be out of sync.
-->
<InsertPages name="table of contents" pages="1" />
<!-- Output all chapters and collect page numbers -->
<ProcessNode select="chapter" />
<!-- Now since we know the page numbers where the chapters begin,
it is possible to typeset the table of contents.
Make sure the name of the saved pages is the same as the name
of the inserted pages above.
-->
<SavePages name="table of contents">
<PlaceObject>
<Table padding="4pt">
<Columns>
<Column width="7cm" />
</Columns>
<Loop select="count(chapter)" variable="n">
<Tr>
<Td>
<Paragraph>
<A link="chapter{$n}">
<Value select="concat($n,' ' , sd:variable('chapter',$n,'title'))" />
<HSpace leader="." />
<Value select="sd:variable('chapter',$n,'page')" />
</A>
</Paragraph>
</Td>
</Tr>
</Loop>
</Table>
</PlaceObject>
</SavePages>
</Record>
</Layout>