Ignore:
Timestamp:
03/31/2013 05:25:21 PM (12 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
ablfs
Children:
9fe527f
Parents:
d0c94a3
Message:

BLFS tools:

  • Separates the groups of xorg package into individual builds
File:
1 edited

Legend:

Unmodified
Added
Removed
  • BLFS/xsl/make_book.xsl

    rd0c94a3 rd236bbd  
    3535  </xsl:template>
    3636
    37 <!-- apply-templates for each id in the list.
     37<!-- apply-templates for each item in the list.
     38     Normally, those items are id of nodes.
    3839     Those nodes can be sect1 (normal case),
    3940     sect2 (python modules or DBus bindings)
    4041     bridgehead (perl modules)
    4142     para (dependency of perl modules).
    42      The templates after this one treat each of those cases-->
     43     The templates after this one treat each of those cases.
     44     However, some items are xorg package names, and not id.
     45     We need special instructions in that case.
     46     The difficulty is that some of those names *are* id's,
     47     because they are referenced in the index.
     48     Hopefully, none of those id's are sect{1,2}, bridgehead or para...-->
    4349  <xsl:template name="apply-list">
    4450    <xsl:param name="list" select="''"/>
     
    4652      <xsl:choose>
    4753        <xsl:when test="contains($list,' ')">
    48           <xsl:apply-templates select="id(substring-before($list,' '))"/>
     54          <xsl:call-template name="apply-list">
     55            <xsl:with-param name="list"
     56                            select="substring-before($list,' ')"/>
     57          </xsl:call-template>
    4958          <xsl:call-template name="apply-list">
    5059            <xsl:with-param name="list"
     
    5362        </xsl:when>
    5463        <xsl:otherwise>
    55           <xsl:apply-templates select="id($list)"/>
     64          <xsl:choose>
     65            <xsl:when test="not(id($list)/self::sect1|sect2|para|bridgehead)">
     66              <xsl:apply-templates
     67                   select="//sect1[contains(string(.//userinput),$list)]"
     68                   mode="xorg">
     69                <xsl:with-param name="package" select="$list"/>
     70              </xsl:apply-templates>
     71            </xsl:when>
     72            <xsl:otherwise>
     73              <xsl:apply-templates select="id($list)"/>
     74            </xsl:otherwise>
     75          </xsl:choose>
    5676        </xsl:otherwise>
    5777      </xsl:choose>
     
    266286    </sect2>
    267287  </xsl:template>
     288
     289<!-- we have got an xorg package. We are at the installation page
     290     but now we need to make an autonomous page from the global
     291     one -->
     292  <xsl:template match="sect1" mode="xorg">
     293    <xsl:param name="package"/>
     294    <xsl:variable name="tarball">
     295      <xsl:call-template name="tarball">
     296        <xsl:with-param name="package" select="$package"/>
     297        <xsl:with-param name="cat-md5"
     298                        select="string(.//userinput[starts-with(string(),'cat')])"/>
     299      </xsl:call-template>
     300    </xsl:variable>
     301    <xsl:variable name="md5sum">
     302      <xsl:call-template name="md5sum">
     303        <xsl:with-param name="package" select="$package"/>
     304        <xsl:with-param name="cat-md5"
     305                        select=".//userinput[starts-with(string(),'cat')]"/>
     306      </xsl:call-template>
     307    </xsl:variable>
     308    <xsl:variable name="install-instructions">
     309      <xsl:call-template name="inst-instr">
     310        <xsl:with-param name="inst-instr"
     311                        select=".//userinput[starts-with(string(),'for')]"/>
     312      </xsl:call-template>
     313    </xsl:variable>
     314    <xsl:element name="sect1">
     315      <xsl:attribute name="id"><xsl:value-of select="$package"/></xsl:attribute>
     316      <xsl:processing-instruction name="dbhtml">
     317         filename="<xsl:value-of select='$package'/>.html"
     318      </xsl:processing-instruction>
     319      <title><xsl:value-of select="$package"/></title>
     320      <sect2 role="package">
     321        <title>Introduction to <xsl:value-of select="$package"/></title>
     322        <bridgehead renderas="sect3">Package Information</bridgehead>
     323        <itemizedlist spacing="compact">
     324          <listitem>
     325            <para>Download (HTTP): <xsl:element name="ulink">
     326              <xsl:attribute name="url">
     327                <xsl:value-of
     328                   select=".//para[contains(string(),'(HTTP)')]/ulink/@url"/>
     329                <xsl:value-of select="$tarball"/>
     330              </xsl:attribute>
     331             </xsl:element>
     332            </para>
     333          </listitem>
     334          <listitem>
     335            <para>Download (FTP): <xsl:element name="ulink">
     336              <xsl:attribute name="url">
     337                <xsl:value-of
     338                   select=".//para[contains(string(),'(FTP)')]/ulink/@url"/>
     339                <xsl:value-of select="$tarball"/>
     340              </xsl:attribute>
     341             </xsl:element>
     342            </para>
     343          </listitem>
     344          <listitem>
     345            <para>
     346              Download MD5 sum: <xsl:value-of select="$md5sum"/>
     347            </para>
     348          </listitem>
     349        </itemizedlist>
     350      </sect2>
     351      <sect2 role="installation">
     352        <title>Installation of <xsl:value-of select="$package"/></title>
     353
     354        <para>
     355          Install <application><xsl:value-of select="$package"/></application>
     356          by running the following commands:
     357        </para>
     358
     359        <screen><userinput>packagedir=<xsl:value-of
     360                    select="substring-before($tarball,'.tar.bz2')"/>
     361          <xsl:text>&#xA;</xsl:text>
     362          <xsl:value-of select="substring-before($install-instructions,
     363                                                 'as_root')"/>
     364        </userinput></screen>
     365
     366        <para>
     367          Now as the <systemitem class="username">root</systemitem> user:
     368        </para>
     369        <screen role='root'>
     370          <userinput><xsl:value-of select="substring-after(
     371                                                 $install-instructions,
     372                                                 'as_root')"/>
     373          </userinput>
     374        </screen>
     375      </sect2>
     376    </xsl:element><!-- sect1 -->
     377
     378  </xsl:template>
     379
     380<!-- get the tarball name from the text that comes from the .md5 file -->
     381  <xsl:template name="tarball">
     382    <xsl:param name="package"/>
     383    <xsl:param name="cat-md5"/>
     384<!-- DEBUG
     385<xsl:message><xsl:text>Entering "tarball" template:
     386  package is: </xsl:text>
     387<xsl:value-of select="$package"/><xsl:text>
     388  cat-md5 is: </xsl:text>
     389<xsl:value-of select="$cat-md5"/>
     390</xsl:message>
     391END DEBUG -->
     392    <xsl:choose>
     393      <xsl:when test="contains(substring-before($cat-md5,$package),'&#xA;')">
     394        <xsl:call-template name="tarball">
     395          <xsl:with-param name="package" select="$package"/>
     396          <xsl:with-param name="cat-md5"
     397                          select="substring-after($cat-md5,'&#xA;')"/>
     398        </xsl:call-template>
     399      </xsl:when>
     400      <xsl:otherwise>
     401        <xsl:copy-of select="substring-after(
     402                                 substring-before($cat-md5,'&#xA;'),'  ')"/>
     403      </xsl:otherwise>
     404    </xsl:choose>
     405  </xsl:template>
     406<!-- same for md5sum -->
     407  <xsl:template name="md5sum">
     408    <xsl:param name="package"/>
     409    <xsl:param name="cat-md5"/>
     410    <xsl:choose>
     411      <xsl:when test="contains(substring-before($cat-md5,$package),'&#xA;')">
     412        <xsl:call-template name="md5sum">
     413          <xsl:with-param name="package" select="$package"/>
     414          <xsl:with-param name="cat-md5"
     415                          select="substring-after($cat-md5,'&#xA;')"/>
     416        </xsl:call-template>
     417      </xsl:when>
     418      <xsl:otherwise>
     419        <xsl:copy-of select="substring-before($cat-md5,'  ')"/>
     420      </xsl:otherwise>
     421    </xsl:choose>
     422  </xsl:template>
     423
     424  <xsl:template name="inst-instr">
     425    <xsl:param name="inst-instr"/>
     426    <xsl:choose>
     427      <xsl:when test="contains($inst-instr,'pushd')">
     428        <xsl:call-template name="inst-instr">
     429          <xsl:with-param name="inst-instr"
     430                          select="substring-after(
     431                                   substring-after($inst-instr,'pushd'),
     432                                   '&#xA;')"/>
     433        </xsl:call-template>
     434      </xsl:when>
     435      <xsl:otherwise>
     436        <xsl:copy-of select="substring-before($inst-instr,'popd')"/>
     437      </xsl:otherwise>
     438    </xsl:choose>
     439  </xsl:template>
    268440</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.