source: dump-commands.xsl@ 63b2859

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

Starting the move of some features to the XSL code.
First try to manage chapter05.

  • Property mode set to 100644
File size: 2.4 KB
RevLine 
[557fe91]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
[63b2859]7<!-- XSLT stylesheet to create shell scripts from LFS books. -->
[557fe91]8
9 <xsl:template match="/">
10 <xsl:apply-templates select="//sect1"/>
11 </xsl:template>
12
13 <xsl:template match="sect1">
14 <!-- The dirs names -->
15 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
16 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
17 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
18 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
19 <!-- The file names -->
20 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
21 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
22 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
23 <!-- The build order -->
24 <xsl:variable name="position" select="position()"/>
25 <xsl:variable name="order">
26 <xsl:choose>
27 <xsl:when test="string-length($position) = 1">
28 <xsl:text>00</xsl:text>
29 <xsl:value-of select="$position"/>
30 </xsl:when>
31 <xsl:when test="string-length($position) = 2">
32 <xsl:text>0</xsl:text>
33 <xsl:value-of select="$position"/>
34 </xsl:when>
35 <xsl:otherwise>
36 <xsl:value-of select="$position"/>
37 </xsl:otherwise>
38 </xsl:choose>
39 </xsl:variable>
40 <!-- Creating dirs and files -->
41 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
[63b2859]42 <xsl:text>#!/bin/sh&#xA;&#xA;</xsl:text>
[557fe91]43 <xsl:apply-templates select=".//screen"/>
44 </exsl:document>
45 </xsl:template>
46
47 <xsl:template match="screen">
48 <xsl:if test="child::* = userinput">
49 <xsl:choose>
50 <xsl:when test="@role = 'nodump'"/>
51 <xsl:otherwise>
52 <xsl:apply-templates select="userinput"/>
53 </xsl:otherwise>
54 </xsl:choose>
55 </xsl:if>
56 </xsl:template>
57
58 <xsl:template match="userinput">
59 <xsl:apply-templates/>
[63b2859]60 <xsl:text> &amp;&amp;&#xA;</xsl:text>
[557fe91]61 </xsl:template>
62
63 <xsl:template match="replaceable">
64 <xsl:text>**EDITME</xsl:text>
65 <xsl:apply-templates/>
66 <xsl:text>EDITME**</xsl:text>
67 </xsl:template>
68
69</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.