Changeset e967368


Ignore:
Timestamp:
05/12/2018 11:29:29 AM (6 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
2.4
Parents:
56a5508
Message:

Fix generation of chroot instructions for newer LFS book

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/chroot.xsl

    r56a5508 re967368  
    1515  <xsl:template match="sect1">
    1616    <xsl:if
    17          test="descendant::screen/userinput[starts-with(string(),'chroot')]">
     17       test="descendant::screen/userinput[contains(string(),'&#xA;chroot') or
     18                                          starts-with(string(),'chroot')]">
    1819   <!-- The file names -->
    1920      <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
     
    4041      <exsl:document href="{$order}-{$filename}" method="text">
    4142        <xsl:text>#!/bin/bash&#xA;</xsl:text>
    42       <xsl:apply-templates select=".//userinput[starts-with(string(),'chroot')]"/>
     43      <xsl:apply-templates
     44           select=".//userinput[contains(string(),'&#xA;chroot') or
     45                                starts-with(string(),'chroot')]"/>
    4346      <xsl:text>exit&#xA;</xsl:text>
    4447    </exsl:document>
     
    4750
    4851  <xsl:template match="userinput">
    49     <xsl:apply-templates/>
    50     <xsl:text>&#xA;</xsl:text>
     52    <xsl:call-template name="extract-chroot">
     53      <xsl:with-param name="instructions" select="string()"/>
     54    </xsl:call-template>
     55  </xsl:template>
     56
     57  <xsl:template name="extract-chroot">
     58    <xsl:param name="instructions" select="''"/>
     59    <xsl:choose>
     60      <xsl:when test="not(starts-with($instructions,'&#xA;chroot')) and
     61                      contains($instructions, '&#xA;chroot')">
     62        <xsl:call-template name="extract-chroot">
     63          <xsl:with-param name="instructions"
     64              select="substring(substring-after($instructions,
     65                                      substring-before($instructions,
     66                                                       '&#xA;chroot')),2)"/>
     67        </xsl:call-template>
     68      </xsl:when>
     69      <xsl:when test="contains($instructions,'\&#xA;')">
     70        <xsl:copy-of select="substring-before($instructions,'\&#xA;')"/>
     71        <xsl:text>\
     72</xsl:text>
     73        <xsl:call-template name="extract-chroot">
     74          <xsl:with-param name="instructions"
     75                          select="substring-after($instructions,'\&#xA;')"/>
     76        </xsl:call-template>
     77      </xsl:when>
     78      <xsl:when test="contains($instructions,'&#xA;')">
     79        <xsl:copy-of select="substring-before($instructions,'&#xA;')"/>
     80        <xsl:text>
     81</xsl:text>
     82      </xsl:when>
     83      <xsl:otherwise>
     84        <xsl:copy-of select="$instructions"/>
     85        <xsl:text>
     86</xsl:text>
     87      </xsl:otherwise>
     88    </xsl:choose>
    5189  </xsl:template>
    5290</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.