Changeset 36f5dce for LFS


Ignore:
Timestamp:
06/09/2020 07:28:05 AM (4 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
ablfs-more, legacy, trunk
Children:
ebe1ba6
Parents:
9ef12f7
Message:

Fix lfs.xsl for cross2, and change scriptlet numbering for trunk and cross2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LFS/lfs.xsl

    r9ef12f7 r36f5dce  
    103103    </xsl:choose>
    104104  </xsl:variable>
     105
     106<!-- Start of templates -->
    105107  <xsl:template match="/">
    106     <xsl:apply-templates select="//sect1[not(@revision) or
    107                                          @revision=$revision]"/>
    108   </xsl:template>
    109 
    110   <xsl:template match="sect1">
    111 <!-- Since this xsl:if tag encloses the whole template, it would
    112      be much better to transpose this condition to the select part
    113      of the "calling" apply-template. But that would change the numbering,
    114      so that it would be difficult to compare to previous versions. So for
    115      version 2.4, let us keep this -->
    116     <xsl:if test="(../@id='chapter-temporary-tools' or
    117                    ../@id='chapter-final-preps' or
    118                    ../@id='chapter-building-system' or
    119                    ../@id='chapter-bootscripts' or
    120                    ../@id='chapter-config' or
    121                    ../@id='chapter-bootable') and
    122                   (sect2[not(@revision) or @revision=$revision]//..|.)/
    123                       screen[(not(@role) or @role != 'nodump') and
    124                              (not(@revision) or @revision=$revision)]/
    125                           userinput[not(starts-with(string(),'chroot'))]">
    126 <!-- The last condition is a hack to allow previous versions of the
     108    <xsl:apply-templates select="//chapter[
     109                                @id='chapter-final-preps' or
     110                                @id='chapter-cross-tools' or
     111                                @id='chapter-temporary-tools' or
     112                                @id='chapter-chroot-temporary-tools' or
     113                                @id='chapter-building-system' or
     114                                @id='chapter-config' or
     115                                @id='chapter-bootscripts' or
     116                                @id='chapter-bootable']"/>
     117  </xsl:template>
     118
     119  <xsl:template match="chapter">
     120    <xsl:apply-templates select="./sect1[
     121             (not(@revision) or @revision=$revision) and
     122             .//screen[(not(@role) or @role != 'nodump') and
     123                       (not(@revision) or @revision=$revision)]/
     124                          userinput[not(starts-with(string(),'chroot'))]]">
     125      <xsl:with-param name="chap-num" select="position()+3"/>
     126    </xsl:apply-templates>
     127<!-- The last condition is a hack to allow old versions of the
    127128     book where the chroot commands did not have role="nodump".
    128129     It only works if the chroot command is the only one on the page -->
    129         <!-- The dirs names -->
    130       <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
    131       <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
    132       <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
    133       <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
     130  </xsl:template>
     131
     132  <xsl:template match="sect1">
     133    <xsl:param name="chap-num" select="'1'"/>
     134    <!-- The dirs names -->
     135    <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
     136    <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
     137    <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
     138    <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
    134139   <!-- The file names -->
    135140    <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
     
    139144    <xsl:variable name="position" select="position()"/>
    140145    <xsl:variable name="order">
    141       <xsl:choose>
    142         <xsl:when test="string-length($position) = 1">
    143           <xsl:text>00</xsl:text>
    144           <xsl:value-of select="$position"/>
    145         </xsl:when>
    146         <xsl:when test="string-length($position) = 2">
    147           <xsl:text>0</xsl:text>
    148           <xsl:value-of select="$position"/>
    149         </xsl:when>
    150         <xsl:otherwise>
    151           <xsl:value-of select="$position"/>
    152         </xsl:otherwise>
    153       </xsl:choose>
     146      <xsl:value-of select="$chap-num"/>
     147      <xsl:if test="string-length($position) = 1">
     148        <xsl:text>0</xsl:text>
     149      </xsl:if>
     150      <xsl:value-of select="$position"/>
    154151    </xsl:variable>
    155152    <!-- Inclusion of package manager scriptlets -->
    156     <xsl:if test="@id='ch-tools-stripping' and $pkgmngt='y'">
     153    <xsl:if test="@id='ch-tools-stripping' and
     154                  $pkgmngt='y' and
     155                  $bashdir='/tools'">
    157156      <xsl:apply-templates
    158               select="document('packageManager.xml')//sect1[contains(@id,'ch-tools')]"
    159               mode="pkgmngt">
     157        select="document('packageManager.xml')//sect1[contains(@id,'ch-tools')]"
     158        mode="pkgmngt">
    160159        <xsl:with-param name="order" select="$order"/>
    161160        <xsl:with-param name="dirname" select="$dirname"/>
    162161      </xsl:apply-templates>
    163162    </xsl:if>
    164     <xsl:if test="@id='ch-system-strippingagain' and $pkgmngt='y'">
     163    <xsl:if test="@id='ch-system-strippingagain' and
     164                  $pkgmngt='y' and
     165                  $bashdir='/tools'">
    165166      <xsl:apply-templates
    166               select="document('packageManager.xml')//sect1[contains(@id,'ch-system')]"
     167              select="document('packageManager.xml')//sect1[
     168                                              contains(@id,'ch-system')]"
    167169              mode="pkgmngt">
    168170        <xsl:with-param name="order" select="$order"/>
     
    215217      <xsl:text>exit&#xA;</xsl:text>
    216218    </exsl:document>
    217     </xsl:if>
    218219  </xsl:template>
    219220
Note: See TracChangeset for help on using the changeset viewer.