source: stylesheets/patcheslist.xsl

trunk
Last change on this file was 2a26a4f5, checked in by Pierre Labastie <pierre.labastie@…>, 3 months ago

Remove all &#xxx; occurences

  • replace some characters by their utf-8 encoded equivalent (and change encoding in the <?xml?> line
  • replace &#xa; with a true newline char. This is somewhat more readable anyway.
  • Property mode set to 100644
File size: 2.2 KB
Line 
1<?xml version='1.0' encoding='UTF-8'?>
2<!DOCTYPE xsl:stylesheet [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
6
7<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8 version="1.0">
9
10 <xsl:output method="text"/>
11
12 <!-- Allow select the dest dir at runtime -->
13 <xsl:param name="dest.dir">
14 <xsl:value-of select="concat('/srv/www/', substring-after('&patches-root;', 'https://'))"/>
15 </xsl:param>
16
17 <xsl:template match="/">
18 <xsl:text>#! /bin/bash
19
20function copy
21{
22 cp $1 $2 >>copyerrs 2>&amp;1
23}
24
25umask 002
26
27# Create dest.dir if it doesn't exist
28# Remove old patches
29# Copy the patches
30# Ensure correct ownership
31install -d -m 775 -g lfswww </xsl:text>
32 <xsl:value-of select="$dest.dir"/>
33 <xsl:text> &amp;&amp;
34cd </xsl:text>
35 <xsl:value-of select="$dest.dir"/>
36 <xsl:text> &amp;&amp;
37rm -f *.patch copyerrs &amp;&amp;
38
39</xsl:text>
40 <xsl:apply-templates/>
41 <xsl:text>
42chgrp lfswww *.patch &amp;&amp;
43if [ `wc -l copyerrs | sed 's/ *//' | cut -f1 -d' '` -gt 0 ]; then
44 mail -s "Missing LFS patches" lfs-book@lists.linuxfromscratch.org &lt; copyerrs
45fi
46
47exit
48</xsl:text>
49 </xsl:template>
50
51 <xsl:template match="//text()"/>
52
53 <xsl:template match="//ulink">
54 <!-- Match only local patches links and skip duplicated URLs splitted for PDF output-->
55 <xsl:if test="contains(@url, '.patch') and contains(@url, '&patches-root;')
56 and not(ancestor-or-self::*/@condition = 'pdf')">
57 <xsl:variable name="patch.name" select="substring-after(@url, '&patches-root;')"/>
58 <xsl:variable name="cut"
59 select="translate(substring-after($patch.name, '-'), '0123456789', '0000000000')"/>
60 <xsl:variable name="patch.name2">
61 <xsl:value-of select="substring-before($patch.name, '-')"/>
62 <xsl:text>-</xsl:text>
63 <xsl:value-of select="$cut"/>
64 </xsl:variable>
65 <xsl:text>copy /srv/www/www.linuxfromscratch.org/patches/downloads/</xsl:text>
66 <xsl:value-of select="substring-before($patch.name2, '-0')"/>
67 <xsl:text>/</xsl:text>
68 <xsl:value-of select="$patch.name"/>
69 <xsl:text> .
70</xsl:text>
71 </xsl:if>
72 </xsl:template>
73
74</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.