source: stylesheets/dump-commands.xsl@ a38df1e

12.1 ken/TL2024 lazarus plabs/newcss rahul/power-profiles-daemon trunk xry111/llvm18
Last change on this file since a38df1e was a804944, checked in by Pierre Labastie <pierre.labastie@…>, 3 months ago

Remove all "&#" characters and replace with utf-8

  • Property mode set to 100644
File size: 2.9 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
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: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">
42 <xsl:apply-templates select=".//screen"/>
43 </exsl:document>
44 </xsl:template>
45
46 <xsl:template match="screen">
47 <xsl:if test="child::* = userinput">
48 <xsl:choose>
49 <xsl:when test="@role = 'nodump'"/>
50 <xsl:when test="@role = 'root'">
51 <xsl:text>
52# Run this as root</xsl:text>
53 <xsl:apply-templates select="userinput"/>
54 <xsl:text># End root commands
55</xsl:text>
56 </xsl:when>
57 <xsl:otherwise>
58 <xsl:apply-templates select="userinput"/>
59 </xsl:otherwise>
60 </xsl:choose>
61 </xsl:if>
62 </xsl:template>
63
64 <xsl:template match="userinput">
65 <xsl:text>
66</xsl:text>
67 <xsl:if test=".//replaceable">
68 <xsl:text># This block must be edited to suit your needs.</xsl:text>
69 </xsl:if>
70 <xsl:text>
71</xsl:text>
72 <xsl:apply-templates/>
73 <xsl:text>
74</xsl:text>
75 <xsl:if test=".//replaceable">
76 <xsl:text># End of editable block.</xsl:text>
77 </xsl:if>
78 <xsl:text>
79</xsl:text>
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.