source: common/chroot.xsl@ 3b27f93

ablfs-more trunk
Last change on this file since 3b27f93 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: 3.3 KB
RevLine 
[d68eb1b]1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<xsl:stylesheet
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5 xmlns:exsl="http://exslt.org/common"
6 extension-element-prefixes="exsl"
7 version="1.0">
8
9 <xsl:template match="/">
10 <xsl:apply-templates select="//sect1"/>
11 </xsl:template>
12
13 <xsl:template match="sect1">
14 <xsl:if
[b86dfaf]15 test="descendant::screen/userinput[contains(string(),'&#xA;chroot') or
16 starts-with(string(),'chroot')]">
[d68eb1b]17 <!-- The file names -->
18 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
19 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
20 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
21 <!-- The build order -->
22 <xsl:variable name="position" select="position()"/>
23 <xsl:variable name="order">
24 <xsl:choose>
25 <xsl:when test="string-length($position) = 1">
26 <xsl:text>00</xsl:text>
27 <xsl:value-of select="$position"/>
28 </xsl:when>
29 <xsl:when test="string-length($position) = 2">
30 <xsl:text>0</xsl:text>
31 <xsl:value-of select="$position"/>
32 </xsl:when>
33 <xsl:otherwise>
34 <xsl:value-of select="$position"/>
35 </xsl:otherwise>
36 </xsl:choose>
37 </xsl:variable>
38 <!-- Creating dirs and files -->
39 <exsl:document href="{$order}-{$filename}" method="text">
40 <xsl:text>#!/bin/bash&#xA;</xsl:text>
[b86dfaf]41 <xsl:apply-templates
42 select=".//userinput[contains(string(),'&#xA;chroot') or
43 starts-with(string(),'chroot')]"/>
[d68eb1b]44 <xsl:text>exit&#xA;</xsl:text>
45 </exsl:document>
46 </xsl:if>
47 </xsl:template>
48
49 <xsl:template match="userinput">
[b86dfaf]50 <xsl:call-template name="extract-chroot">
51 <xsl:with-param name="instructions" select="string()"/>
52 </xsl:call-template>
53 </xsl:template>
54
55 <xsl:template name="extract-chroot">
56 <xsl:param name="instructions" select="''"/>
57 <xsl:choose>
58 <xsl:when test="not(starts-with($instructions,'&#xA;chroot')) and
59 contains($instructions, '&#xA;chroot')">
60 <xsl:call-template name="extract-chroot">
61 <xsl:with-param name="instructions"
62 select="substring(substring-after($instructions,
63 substring-before($instructions,
64 '&#xA;chroot')),2)"/>
65 </xsl:call-template>
66 </xsl:when>
67 <xsl:when test="contains($instructions,'\&#xA;')">
68 <xsl:copy-of select="substring-before($instructions,'\&#xA;')"/>
69 <xsl:text>\
70</xsl:text>
71 <xsl:call-template name="extract-chroot">
72 <xsl:with-param name="instructions"
73 select="substring-after($instructions,'\&#xA;')"/>
74 </xsl:call-template>
75 </xsl:when>
76 <xsl:when test="contains($instructions,'&#xA;')">
77 <xsl:copy-of select="substring-before($instructions,'&#xA;')"/>
78 <xsl:text>
79</xsl:text>
80 </xsl:when>
81 <xsl:otherwise>
82 <xsl:copy-of select="$instructions"/>
83 <xsl:text>
84</xsl:text>
85 </xsl:otherwise>
86 </xsl:choose>
[d68eb1b]87 </xsl:template>
88</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.