Mercurial > hgbook
comparison stylesheets/all-ids.xsl @ 728:bae6d1503482
Rename xsl to stylesheets
author | Dongsheng Song <dongsheng.song@gmail.com> |
---|---|
date | Thu, 12 Mar 2009 17:11:59 +0800 |
parents | xsl/all-ids.xsl@23dc79421e06 |
children |
comparison
equal
deleted
inserted
replaced
727:0e3d8f66bbb7 | 728:bae6d1503482 |
---|---|
1 <?xml version="1.0" encoding="utf-8"?> | |
2 | |
3 <!-- Prepare an ASCII dump file of all IDs, and the pages in which | |
4 they live, for loading into a database. Assumes one-level chunked | |
5 HTML output, with each chunk containing either a chapter or | |
6 sect1. --> | |
7 | |
8 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
9 version="1.0"> | |
10 | |
11 <xsl:output method="text"/> | |
12 <xsl:strip-space elements="title"/> | |
13 | |
14 <xsl:template match="/"> | |
15 <xsl:for-each select="//preface|//chapter|//appendix|//bibliography|//sect1"> | |
16 <xsl:variable name="id"> | |
17 <xsl:choose> | |
18 <xsl:when test="local-name(.)='sect1'"> | |
19 <xsl:value-of select="../@id"/> | |
20 </xsl:when> | |
21 <xsl:otherwise> | |
22 <xsl:value-of select="@id"/> | |
23 </xsl:otherwise> | |
24 </xsl:choose> | |
25 </xsl:variable> | |
26 <xsl:variable name="sectitle"> | |
27 <xsl:value-of select="normalize-space(./title)"/> | |
28 </xsl:variable> | |
29 <xsl:for-each select=".//para[@id]|.//programlisting[@id]|.//screen[@id]"> | |
30 <xsl:value-of select="@id"/> | |
31 <xsl:text>|</xsl:text> | |
32 <xsl:copy-of select="$id"/> | |
33 <xsl:text>|</xsl:text> | |
34 <xsl:copy-of select="$sectitle"/> | |
35 <xsl:text>
</xsl:text> | |
36 </xsl:for-each> | |
37 </xsl:for-each> | |
38 </xsl:template> | |
39 | |
40 </xsl:stylesheet> |