1 | <?xml version='1.0'?>
|
---|
2 | <!--
|
---|
3 | Find the image dependencies of a certain XML file
|
---|
4 | Generates (part of) a Makefile
|
---|
5 |
|
---|
6 | - $(FNAME)-images-latex-{png,dvi} for role=latex
|
---|
7 | - $(FNAME)-images-role for all other roles
|
---|
8 | - $(TXTDIR)/$(FNAME)-text
|
---|
9 |
|
---|
10 | (C) Jelmer Vernooij 2004-2005
|
---|
11 | -->
|
---|
12 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1">
|
---|
13 | <xsl:output method="text"/>
|
---|
14 |
|
---|
15 | <xsl:template match="/">
|
---|
16 | <xsl:for-each select="//mediaobject/imageobject[@role and not(@role=following::imageobject/@role)]">
|
---|
17 | <xsl:call-template name="generate-images">
|
---|
18 | <xsl:with-param name="role"><xsl:value-of select="@role"/></xsl:with-param>
|
---|
19 | </xsl:call-template>
|
---|
20 | </xsl:for-each>
|
---|
21 | <xsl:call-template name="generate-images">
|
---|
22 | <xsl:with-param name="role"/>
|
---|
23 | </xsl:call-template>
|
---|
24 | <xsl:call-template name="generate-txt-chunks"/>
|
---|
25 | </xsl:template>
|
---|
26 |
|
---|
27 | <xsl:template name="generate-images">
|
---|
28 | <xsl:param name="role"/>
|
---|
29 | <xsl:value-of select="$target"/><xsl:text>-images-</xsl:text><xsl:value-of select="$role"/><xsl:text> = </xsl:text>
|
---|
30 | <xsl:for-each select="//mediaobject/imageobject[@role=$role]">
|
---|
31 | <xsl:value-of select="imagedata/@fileref"/>
|
---|
32 | <xsl:text> </xsl:text>
|
---|
33 | </xsl:for-each>
|
---|
34 | <xsl:text> </xsl:text>
|
---|
35 | </xsl:template>
|
---|
36 |
|
---|
37 | <xsl:template name="generate-txt-chunks">
|
---|
38 | <xsl:value-of select="$target"/><xsl:text>-txt-chunks: </xsl:text>
|
---|
39 | <xsl:for-each select="(//chapter|//preface|//appendix)[@id]|book">
|
---|
40 | <xsl:value-of select="$txtbasedir"/>
|
---|
41 | <xsl:choose>
|
---|
42 | <xsl:when test="name() = 'book'">
|
---|
43 | <xsl:text>index</xsl:text>
|
---|
44 | </xsl:when>
|
---|
45 | <xsl:when test="@id != ''">
|
---|
46 | <xsl:value-of select="@id"/>
|
---|
47 | </xsl:when>
|
---|
48 | </xsl:choose>
|
---|
49 | <xsl:text>.txt </xsl:text>
|
---|
50 | </xsl:for-each>
|
---|
51 | <xsl:text> </xsl:text>
|
---|
52 | </xsl:template>
|
---|
53 | </xsl:stylesheet>
|
---|