2014-01-12 22:40:20 +01:00
|
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
|
|
|
2014-01-12 22:43:04 +01:00
|
|
|
<!-- $Id$ -->
|
2014-01-12 22:40:20 +01:00
|
|
|
|
|
|
|
<xsl:stylesheet
|
|
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
|
|
xmlns:exsl="http://exslt.org/common"
|
|
|
|
extension-element-prefixes="exsl"
|
|
|
|
version="1.0">
|
|
|
|
|
|
|
|
<xsl:template match="/">
|
|
|
|
<xsl:apply-templates select="//sect1"/>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template match="sect1">
|
|
|
|
<xsl:if
|
2018-05-12 13:27:10 +02:00
|
|
|
test="descendant::screen/userinput[contains(string(),'
chroot') or
|
|
|
|
starts-with(string(),'chroot')]">
|
2014-01-12 22:40:20 +01:00
|
|
|
<!-- The file names -->
|
|
|
|
<xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
|
|
|
<xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
|
|
|
<xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
|
|
|
<!-- The build order -->
|
|
|
|
<xsl:variable name="position" select="position()"/>
|
|
|
|
<xsl:variable name="order">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="string-length($position) = 1">
|
|
|
|
<xsl:text>00</xsl:text>
|
|
|
|
<xsl:value-of select="$position"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="string-length($position) = 2">
|
|
|
|
<xsl:text>0</xsl:text>
|
|
|
|
<xsl:value-of select="$position"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="$position"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:variable>
|
|
|
|
<!-- Creating dirs and files -->
|
|
|
|
<exsl:document href="{$order}-{$filename}" method="text">
|
|
|
|
<xsl:text>#!/bin/bash
</xsl:text>
|
2018-05-12 13:27:10 +02:00
|
|
|
<xsl:apply-templates
|
|
|
|
select=".//userinput[contains(string(),'
chroot') or
|
|
|
|
starts-with(string(),'chroot')]"/>
|
2014-01-12 22:40:20 +01:00
|
|
|
<xsl:text>exit
</xsl:text>
|
|
|
|
</exsl:document>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template match="userinput">
|
2018-05-12 13:27:10 +02:00
|
|
|
<xsl:call-template name="extract-chroot">
|
|
|
|
<xsl:with-param name="instructions" select="string()"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template name="extract-chroot">
|
|
|
|
<xsl:param name="instructions" select="''"/>
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="not(starts-with($instructions,'
chroot')) and
|
|
|
|
contains($instructions, '
chroot')">
|
|
|
|
<xsl:call-template name="extract-chroot">
|
|
|
|
<xsl:with-param name="instructions"
|
|
|
|
select="substring(substring-after($instructions,
|
|
|
|
substring-before($instructions,
|
|
|
|
'
chroot')),2)"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="contains($instructions,'\
')">
|
|
|
|
<xsl:copy-of select="substring-before($instructions,'\
')"/>
|
|
|
|
<xsl:text>\
|
|
|
|
</xsl:text>
|
|
|
|
<xsl:call-template name="extract-chroot">
|
|
|
|
<xsl:with-param name="instructions"
|
|
|
|
select="substring-after($instructions,'\
')"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="contains($instructions,'
')">
|
|
|
|
<xsl:copy-of select="substring-before($instructions,'
')"/>
|
|
|
|
<xsl:text>
|
|
|
|
</xsl:text>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:copy-of select="$instructions"/>
|
|
|
|
<xsl:text>
|
|
|
|
</xsl:text>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2014-01-12 22:40:20 +01:00
|
|
|
</xsl:template>
|
|
|
|
</xsl:stylesheet>
|