annotate stylesheets/all-ids.xsl @ 770:eb11ec9eed8c

Better file names
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 09 Apr 2009 22:52:01 -0700
parents bae6d1503482
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
656
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
1 <?xml version="1.0" encoding="utf-8"?>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
2
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
3 <!-- Prepare an ASCII dump file of all IDs, and the pages in which
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
4 they live, for loading into a database. Assumes one-level chunked
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
5 HTML output, with each chunk containing either a chapter or
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
6 sect1. -->
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
7
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
8 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
9 version="1.0">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
10
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
11 <xsl:output method="text"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
12 <xsl:strip-space elements="title"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
13
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
14 <xsl:template match="/">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
15 <xsl:for-each select="//preface|//chapter|//appendix|//bibliography|//sect1">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
16 <xsl:variable name="id">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
17 <xsl:choose>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
18 <xsl:when test="local-name(.)='sect1'">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
19 <xsl:value-of select="../@id"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
20 </xsl:when>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
21 <xsl:otherwise>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
22 <xsl:value-of select="@id"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
23 </xsl:otherwise>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
24 </xsl:choose>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
25 </xsl:variable>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
26 <xsl:variable name="sectitle">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
27 <xsl:value-of select="normalize-space(./title)"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
28 </xsl:variable>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
29 <xsl:for-each select=".//para[@id]|.//programlisting[@id]|.//screen[@id]">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
30 <xsl:value-of select="@id"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
31 <xsl:text>|</xsl:text>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
32 <xsl:copy-of select="$id"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
33 <xsl:text>|</xsl:text>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
34 <xsl:copy-of select="$sectitle"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
35 <xsl:text>&#x0a;</xsl:text>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
36 </xsl:for-each>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
37 </xsl:for-each>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
38 </xsl:template>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
39
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
40 </xsl:stylesheet>