1<?xml version="1.0" encoding="utf-8"?> 2<!-- 3 Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com> 4 5 Distributed under the Boost Software License, Version 1.0. 6 (See accompanying file LICENSE_1_0.txt or copy at 7 http://www.boost.org/LICENSE_1_0.txt) 8 --> 9<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 10 version="1.0"> 11 <xsl:key name="library-categories" match="library" 12 use="libraryinfo/librarycategory/@name"/> 13 14 <xsl:template match="librarylist"> 15 <itemizedlist spacing="compact"> 16 <xsl:apply-templates select="//library" 17 mode="build-library-list"> 18 <xsl:sort select="@name"/> 19 </xsl:apply-templates> 20 </itemizedlist> 21 </xsl:template> 22 23 <xsl:template name="library.link"> 24 <xsl:param name="node" select="."/> 25 <xsl:param name="name" select="$node/attribute::name"/> 26 27 <xsl:choose> 28 <xsl:when test="$node/attribute::html-only = 1"> 29 <xsl:variable name="url"> 30 <xsl:choose> 31 <xsl:when test="$node/attribute::url"> 32 <xsl:value-of select="$node/attribute::url"/> 33 </xsl:when> 34 <xsl:otherwise> 35 <xsl:value-of select="concat($boost.root, 36 '/libs/', 37 $node/attribute::dirname, 38 '/index.html')"/> 39 </xsl:otherwise> 40 </xsl:choose> 41 </xsl:variable> 42 <ulink> 43 <xsl:attribute name="url"> 44 <xsl:value-of select="$url"/> 45 </xsl:attribute> 46 <xsl:value-of select="$name"/> 47 </ulink> 48 </xsl:when> 49 <xsl:otherwise> 50 <xsl:call-template name="internal-link"> 51 <xsl:with-param name="to"> 52 <xsl:choose> 53 <xsl:when test="$node/attribute::id"> 54 <xsl:value-of select="$node/attribute::id"/> 55 </xsl:when> 56 <xsl:otherwise> 57 <xsl:call-template name="generate.id"> 58 <xsl:with-param name="node" select="$node"/> 59 </xsl:call-template> 60 </xsl:otherwise> 61 </xsl:choose> 62 </xsl:with-param> 63 <xsl:with-param name="text" select="$name"/> 64 </xsl:call-template> 65 </xsl:otherwise> 66 </xsl:choose> 67 </xsl:template> 68 69 <xsl:template match="library" mode="build-library-list"> 70 <listitem> 71 <simpara> 72 <xsl:call-template name="library.link"/> 73 <xsl:text> - </xsl:text> 74 <xsl:apply-templates select="libraryinfo/librarypurpose" 75 mode="build-library-list"/> 76 </simpara> 77 </listitem> 78 </xsl:template> 79 80 <xsl:template match="librarypurpose" mode="build-library-list"> 81 <xsl:apply-templates/> 82 <xsl:text>, from </xsl:text> 83 <xsl:apply-templates select="../author" mode="display-author-list"/> 84 </xsl:template> 85 86 <xsl:template match="author" mode="display-author-list"> 87 <xsl:if test="(position() > 1) and (count(../author) > 2)"> 88 <xsl:text>, </xsl:text> 89 </xsl:if> 90 <xsl:if test="(position() = count(../author)) and (position() > 1)"> 91 <xsl:if test="position() < 3"> 92 <xsl:text> </xsl:text> 93 </xsl:if> 94 <xsl:text>and </xsl:text> 95 </xsl:if> 96 <xsl:apply-templates select="firstname/text()"/> 97 <xsl:text> </xsl:text> 98 <xsl:apply-templates select="surname/text()"/> 99 <xsl:if test="(position() = count(../author))"> 100 <xsl:text>.</xsl:text> 101 </xsl:if> 102 </xsl:template> 103 104 <xsl:template match="librarycategorylist"> 105 <xsl:apply-templates/> 106 </xsl:template> 107 108 <xsl:template match="librarycategorydef"> 109 <section> 110 <title><xsl:apply-templates/></title> 111 <xsl:variable name="name" select="@name"/> 112 <itemizedlist spacing="compact"> 113 <xsl:apply-templates select="key('library-categories', $name)" 114 mode="build-library-list"> 115 <xsl:sort select="@name"/> 116 </xsl:apply-templates> 117 </itemizedlist> 118 </section> 119 </xsl:template> 120 121 <xsl:template match="libraryinfo"> 122 <chapterinfo> 123 <xsl:apply-templates select="author|authorgroup/author|copyright|legalnotice"/> 124 </chapterinfo> 125 </xsl:template> 126 127 <xsl:template match="librarypurpose|librarycategory"/> 128 129</xsl:stylesheet> 130