source: BOOK/stylesheets/md5sum.xsl@ e247cb3

clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since e247cb3 was 60b0948, checked in by William Harrington <kb0iic@…>, 11 years ago

Add md5sum stylesheet.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?>
2<!DOCTYPE xsl:stylesheet [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
6
7<!--
8XSLT stylesheet to create md5sum file for packages and patches to check integrity.
9Only for Cross-LFS.
10
11Usage example:
12
13xsltproc -xinclude -nonet -output mips64.md5sum stylesheets/md5sum.xsl materials/mips64-chapter.xml
14-->
15
16<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
17 version="1.0">
18
19 <xsl:output method="text"/>
20
21 <xsl:template match="/">
22 <xsl:apply-templates select="//ulink"/>
23 </xsl:template>
24
25 <xsl:template name="filename-basename">
26 <!-- We assume all filenames are really URIs and use "/" -->
27 <xsl:param name="filename"></xsl:param>
28 <xsl:param name="recurse" select="false()"/>
29
30 <xsl:choose>
31 <xsl:when test="contains($filename, '/')">
32 <xsl:call-template name="filename-basename">
33 <xsl:with-param name="filename"
34 select="substring-after($filename, '/')"/>
35 <xsl:with-param name="recurse" select="true()"/>
36 </xsl:call-template>
37 </xsl:when>
38 <xsl:otherwise>
39 <xsl:choose>
40 <xsl:when test="contains($filename, '?')">
41 <xsl:value-of select="substring-before($filename,'?')"/>
42 </xsl:when>
43 <xsl:otherwise>
44 <xsl:value-of select="$filename"/>
45 </xsl:otherwise>
46 </xsl:choose>
47 </xsl:otherwise>
48 </xsl:choose>
49 </xsl:template>
50
51 <xsl:template match="ulink">
52 <!-- Packages. If some package don't have the string ".tar." in their
53 name, the next test must be fixed to match it also. -->
54 <xsl:if test="contains(@url, '.tar.') or contains(@url, '.tgz')
55 or contains(@url, '.patch') and contains(@url, '&patches-root;')
56 and not(ancestor-or-self::*/@condition = 'pdf')">
57 <xsl:value-of select="../following-sibling::para/literal"/>
58 <xsl:text> </xsl:text>
59 <xsl:call-template name="filename-basename">
60 <xsl:with-param name="filename" select="@url"/>
61 <xsl:with-param name="recurse" select="true()"/>
62 </xsl:call-template>
63 <xsl:text>&#x0a;</xsl:text>
64 </xsl:if>
65 </xsl:template>
66
67</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.