hgbook
annotate stylesheets/all-ids.xsl @ 791:bf84d6b2281c
Minor changes and translation of code snippets for Ch.7.
author | Giulio@puck |
---|---|
date | Tue Aug 11 23:01:30 2009 +0200 (2009-08-11) |
parents | 23dc79421e06 |
children |
rev | line source |
---|---|
bos@557 | 1 <?xml version="1.0" encoding="utf-8"?> |
bos@557 | 2 |
bos@557 | 3 <!-- Prepare an ASCII dump file of all IDs, and the pages in which |
bos@557 | 4 they live, for loading into a database. Assumes one-level chunked |
bos@557 | 5 HTML output, with each chunk containing either a chapter or |
bos@557 | 6 sect1. --> |
bos@557 | 7 |
bos@557 | 8 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
bos@557 | 9 version="1.0"> |
bos@557 | 10 |
bos@557 | 11 <xsl:output method="text"/> |
bos@557 | 12 <xsl:strip-space elements="title"/> |
bos@557 | 13 |
bos@557 | 14 <xsl:template match="/"> |
bos@557 | 15 <xsl:for-each select="//preface|//chapter|//appendix|//bibliography|//sect1"> |
bos@557 | 16 <xsl:variable name="id"> |
bos@557 | 17 <xsl:choose> |
bos@557 | 18 <xsl:when test="local-name(.)='sect1'"> |
bos@557 | 19 <xsl:value-of select="../@id"/> |
bos@557 | 20 </xsl:when> |
bos@557 | 21 <xsl:otherwise> |
bos@557 | 22 <xsl:value-of select="@id"/> |
bos@557 | 23 </xsl:otherwise> |
bos@557 | 24 </xsl:choose> |
bos@557 | 25 </xsl:variable> |
bos@557 | 26 <xsl:variable name="sectitle"> |
bos@557 | 27 <xsl:value-of select="normalize-space(./title)"/> |
bos@557 | 28 </xsl:variable> |
bos@557 | 29 <xsl:for-each select=".//para[@id]|.//programlisting[@id]|.//screen[@id]"> |
bos@557 | 30 <xsl:value-of select="@id"/> |
bos@557 | 31 <xsl:text>|</xsl:text> |
bos@557 | 32 <xsl:copy-of select="$id"/> |
bos@557 | 33 <xsl:text>|</xsl:text> |
bos@557 | 34 <xsl:copy-of select="$sectitle"/> |
bos@557 | 35 <xsl:text>
</xsl:text> |
bos@557 | 36 </xsl:for-each> |
bos@557 | 37 </xsl:for-each> |
bos@557 | 38 </xsl:template> |
bos@557 | 39 |
bos@557 | 40 </xsl:stylesheet> |