source: dump-commands.xsl@ b8bf2f8

0.2 1.0 2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since b8bf2f8 was b8bf2f8, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Fixed the creation of "cat ... EOF" blocks.

  • Property mode set to 100644
File size: 2.8 KB
Line 
1<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:exsl="http://exslt.org/common"
4 extension-element-prefixes="exsl"
5 version="1.0">
6
7<!-- XSLT stylesheet to create shell scripts from LFS books. -->
8
9 <xsl:template match="/">
10 <xsl:apply-templates select="//sect1"/>
11 </xsl:template>
12
13 <xsl:template match="sect1">
14 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
15 count(descendant::screen/userinput) &gt; count(descendant::screen[@role='nodump'])">
16 <!-- The dirs names -->
17 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
18 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
19 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
20 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
21 <!-- The file names -->
22 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
23 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
24 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
25 <!-- The build order -->
26 <xsl:variable name="position" select="position()"/>
27 <xsl:variable name="order">
28 <xsl:choose>
29 <xsl:when test="string-length($position) = 1">
30 <xsl:text>00</xsl:text>
31 <xsl:value-of select="$position"/>
32 </xsl:when>
33 <xsl:when test="string-length($position) = 2">
34 <xsl:text>0</xsl:text>
35 <xsl:value-of select="$position"/>
36 </xsl:when>
37 <xsl:otherwise>
38 <xsl:value-of select="$position"/>
39 </xsl:otherwise>
40 </xsl:choose>
41 </xsl:variable>
42 <!-- Creating dirs and files -->
43 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
44 <xsl:text>#!/bin/sh&#xA;&#xA;</xsl:text>
45 <xsl:apply-templates select=".//screen"/>
46 </exsl:document>
47 </xsl:if>
48 </xsl:template>
49
50 <xsl:template match="screen">
51 <xsl:if test="child::* = userinput">
52 <xsl:choose>
53 <xsl:when test="@role = 'nodump'"/>
54 <xsl:otherwise>
55 <xsl:apply-templates select="userinput"/>
56 <xsl:if test="position() != last() and
57 not(contains(string(),'EOF'))">
58 <xsl:text> &amp;&amp;</xsl:text>
59 </xsl:if>
60 <xsl:text>&#xA;</xsl:text>
61 </xsl:otherwise>
62 </xsl:choose>
63 </xsl:if>
64 </xsl:template>
65
66 <xsl:template match="userinput">
67 <xsl:apply-templates/>
68 </xsl:template>
69
70 <xsl:template match="replaceable">
71 <xsl:text>**EDITME</xsl:text>
72 <xsl:apply-templates/>
73 <xsl:text>EDITME**</xsl:text>
74 </xsl:template>
75
76</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.