[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

</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> &&
</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>
|
---|