source: common/hostreqs.xsl@ 1870b56

ablfs-more legacy trunk
Last change on this file since 1870b56 was fd4a798, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove $Id$ comments, they are useless with git

  • Property mode set to 100644
File size: 2.6 KB
RevLine 
[1cf621b]1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<!-- Extracts minimal versions from LFS book host requirements,
4 and generates a script containing statements of the
5 form MIN_prog_VERSION=xx.yy.zz.
6-->
7
8<xsl:stylesheet
9 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10 version="1.0">
11
12 <xsl:output method="text"/>
13
14 <xsl:template match="/sect1">
15 <xsl:apply-templates select=".//listitem//emphasis"/>
16 </xsl:template>
17
18 <xsl:template match="emphasis">
[b86876a]19<!-- We assume that what is emphasized is in the form:
20aa...aa-dccsaaa (a anything except @, - "dash", d digit,
[2e1c1c3]21 c anything except space, s space)
[b86876a]22or
23aa...aasdccsaaa
24This means we have to replace digits with @, and look for '-@'
25or ' @' -->
26 <xsl:variable name="normalized-string"
27 select="translate(normalize-space(string()),
28 '0123456789',
29 '@@@@@@@@@@')"/>
30 <xsl:variable name="begin-ver">
31 <xsl:choose>
32 <xsl:when test="contains($normalized-string,' @')">
33 <xsl:value-of select="string-length(substring-before($normalized-string,' @'))+1"/>
34 </xsl:when>
35 <xsl:otherwise>
36 <xsl:value-of select="string-length(substring-before($normalized-string,'-@'))+1"/>
37 </xsl:otherwise>
38 </xsl:choose>
39 </xsl:variable>
40
41 <xsl:variable name="remaining-part"
42 select="substring($normalized-string,number($begin-ver)+1)"/>
43
44 <xsl:variable name="end-ver">
45 <xsl:choose>
46 <xsl:when test="contains($remaining-part,' ')">
47 <xsl:value-of
48 select="string-length(substring-before($remaining-part,' '))"/>
49 </xsl:when>
50 <xsl:otherwise>
51 <xsl:value-of
52 select="string-length($remaining-part)"/>
53 </xsl:otherwise>
54 </xsl:choose>
55 </xsl:variable>
56
[1cf621b]57 <xsl:text>local MIN_</xsl:text>
58 <xsl:choose>
[b86876a]59 <xsl:when test="contains(string(),'Kernel')">
60 <xsl:text>Linux</xsl:text>
61 </xsl:when>
62 <xsl:when test="contains(string(),'GLIBC')">
63 <xsl:text>Glibc</xsl:text>
64 </xsl:when>
65 <xsl:when test="contains(string(),'XZ')">
66 <xsl:text>Xz</xsl:text>
[1cf621b]67 </xsl:when>
68 <xsl:otherwise>
[b86876a]69<!-- We assume that there are no dash nor space in other names -->
70 <xsl:value-of select="substring(string(),1,number($begin-ver)-1)"/>
[1cf621b]71 </xsl:otherwise>
72 </xsl:choose>
73 <xsl:text>_VER=</xsl:text>
[b86876a]74 <xsl:value-of select="substring(string(),number($begin-ver)+1,$end-ver)"/>
[1cf621b]75 <xsl:text>
76</xsl:text>
77 </xsl:template>
78</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.