hgbook

annotate stylesheets/all-ids.xsl @ 673:dbe5f4bb6507

Ignore more
author Bryan O'Sullivan <bos@serpentine.com>
date Thu Apr 09 22:54:10 2009 -0700 (2009-04-09)
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>&#x0a;</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>