source: stylesheets/dump-commands.xsl@ 7152faa

12.1 12.1-rc1 multilib trunk xry111/arm64 xry111/clfs-ng xry111/loongarch xry111/loongarch-12.1 xry111/mips64el xry111/update-glibc
Last change on this file since 7152faa was 2a26a4f5, checked in by Pierre Labastie <pierre.labastie@…>, 5 months ago

Remove all &#xxx; occurences

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