source: stylesheets/dump-commands.xsl@ c32384e

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since c32384e was 85117fe2, checked in by Dan Nichilson <dnicholson@…>, 17 years ago

Cleanup newline generation in dump-commands

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8225 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 3.0 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 extract commands from [B,H]LFS books. -->
8
9 <xsl:variable name="newline">
10 <xsl:text>&#xA;</xsl:text>
11 </xsl:variable>
12
13 <xsl:template match="/">
14 <xsl:apply-templates select="//sect1"/>
15 </xsl:template>
16
17 <xsl:template match="sect1">
18 <!-- The dirs names -->
19 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
20 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
21 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
22 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
23 <!-- The file names -->
24 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
25 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
26 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
27 <!-- The build order -->
28 <xsl:variable name="position" select="position()"/>
29 <xsl:variable name="order">
30 <xsl:choose>
31 <xsl:when test="string-length($position) = 1">
32 <xsl:text>00</xsl:text>
33 <xsl:value-of select="$position"/>
34 </xsl:when>
35 <xsl:when test="string-length($position) = 2">
36 <xsl:text>0</xsl:text>
37 <xsl:value-of select="$position"/>
38 </xsl:when>
39 <xsl:otherwise>
40 <xsl:value-of select="$position"/>
41 </xsl:otherwise>
42 </xsl:choose>
43 </xsl:variable>
44 <!-- Creating dirs and files -->
45 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
46 <xsl:apply-templates select=".//screen"/>
47 </exsl:document>
48 </xsl:template>
49
50 <xsl:template match="screen">
51 <xsl:if test="child::* = userinput">
52 <xsl:choose>
53 <xsl:when test="@role = 'root'">
54 <xsl:text># Run this as root</xsl:text>
55 <xsl:value-of select="$newline"/>
56 <xsl:apply-templates select="userinput"/>
57 <xsl:text># End root commands</xsl:text>
58 <xsl:value-of select="$newline"/>
59 </xsl:when>
60 <xsl:otherwise>
61 <xsl:apply-templates select="userinput"/>
62 </xsl:otherwise>
63 </xsl:choose>
64 <xsl:value-of select="$newline"/>
65 </xsl:if>
66 </xsl:template>
67
68 <xsl:template match="userinput">
69 <xsl:if test=".//replaceable">
70 <xsl:text># This block must be edited to suit your needs.</xsl:text>
71 <xsl:value-of select="$newline"/>
72 </xsl:if>
73 <xsl:apply-templates/>
74 <xsl:value-of select="$newline"/>
75 <xsl:if test=".//replaceable">
76 <xsl:text># End of editable block.</xsl:text>
77 <xsl:value-of select="$newline"/>
78 </xsl:if>
79 </xsl:template>
80
81 <xsl:template match="replaceable">
82 <xsl:text>**EDITME</xsl:text>
83 <xsl:apply-templates/>
84 <xsl:text>EDITME**</xsl:text>
85 </xsl:template>
86
87</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.