Index: BLFS/gen-special.sh
===================================================================
--- BLFS/gen-special.sh	(revision b39f283e3d5de90f3e1e12bda88c3f5f49be2c5e)
+++ BLFS/gen-special.sh	(revision 0cd09c69545e2bae0bea15333bc97f0a2ec452d6)
@@ -99,5 +99,7 @@
     <xsl:choose>
 EOF
-for file in $(ls ${BLFS_DIR}/x/installing/x7* | grep -v x7driver); do
+for file in $(ls ${BLFS_DIR}/x/installing/x7* | grep -v x7driver) \
+	    ${BLFS_DIR}/kde/kf5/kf5-frameworks.xml                \
+	    ${BLFS_DIR}/kde/plasma5/plasma-all.xml; do
   id=$(grep xreflabel $file | sed 's@.*id="\([^"]*\).*@\1@')
   cat >>$SPECIAL_FILE << EOF
@@ -117,24 +119,33 @@
 # that the preceding package is a dependency of the following,
 # except the first.
-  list_cat="$(sed -n '/>cat/,/EOF</p' $file | grep -v 'cat\|EOF\|#' |
+list_cat="$(sed -n '/>cat.*\.\(md5\|dat\)/,/EOF</p' $file | grep -v 'cat\|EOF\|#' |
               awk '{ print $NF }' | sed 's/-&.*//')"
 
-# Rationale for the sed below: the following for breaks words at spaces (unless
-# we tweak IFS). So replace spaces with commas in lines so that only newlines
-# are separators.
-  for pack in \
-      $(grep 'ENTITY.*version' $file | sed 's/[ ]\+/,/g'); do
-    packname=$(echo $pack | sed s'@.*ENTITY,\(.*\)-version.*@\1@')
-    packversion=$(echo $pack | sed 's@[^"]*"\([^"]*\).*@\1@')
-    precpack=NONE
-    for i in $list_cat; do
-      if [ "$i" = "$packname" ]; then break; fi
-      precpack=$i
-    done
-# It may happen that packname is not in list_cat, because its entity
-# is commented out in the xml, but we do not check that (too complicated).
-# In that case, the whole list is scanned, and $precpack=$i at the end.
-# when packname is found in the list $precpack!=$i.
-    if [ "$precpack" = "$i" ]; then continue; fi
+  precpack=NONE
+  for pack in $list_cat; do
+    if grep -q x7 $file; then # this is an xorg package
+      packname=$pack
+      packversion=$(grep "ENTITY ${pack}-version" $file | \
+	            sed 's@[^"]*"\([^"]*\).*@\1@')
+    else
+      packname=${pack%%-[[:digit:]]*}
+      packversion=$(echo $pack | sed 's/[^.]*-\([.[:digit:]]*\)\.tar.*/\1/')
+    fi
+## Rationale for the sed below: the following for breaks words at spaces (unless
+## we tweak IFS). So replace spaces with commas in lines so that only newlines
+## are separators.
+#  for pack in \
+#      $(grep 'ENTITY.*version' $file | sed 's/[ ]\+/,/g'); do
+#    packname=$(echo $pack | sed s'@.*ENTITY,\(.*\)-version.*@\1@')
+#    packversion=$(echo $pack | sed 's@[^"]*"\([^"]*\).*@\1@')
+#    for i in $list_cat; do
+#      if [ "$i" = "$packname" ]; then break; fi
+#      precpack=$i
+#    done
+## It may happen that packname is not in list_cat, because its entity
+## is commented out in the xml, but we do not check that (too complicated).
+## In that case, the whole list is scanned, and $precpack=$i at the end.
+## when packname is found in the list $precpack!=$i.
+#    if [ "$precpack" = "$i" ]; then continue; fi
     cat >>$SPECIAL_FILE << EOF
         <module><xsl:text>&#xA;          </xsl:text>
@@ -183,4 +194,5 @@
         </xsl:element>
 EOF
+    precpack=$packname
   done
   cat >>$SPECIAL_FILE << EOF
Index: BLFS/xsl/gen_config.xsl
===================================================================
--- BLFS/xsl/gen_config.xsl	(revision b39f283e3d5de90f3e1e12bda88c3f5f49be2c5e)
+++ BLFS/xsl/gen_config.xsl	(revision 0cd09c69545e2bae0bea15333bc97f0a2ec452d6)
@@ -310,5 +310,7 @@
 &#9;&#9;&#9;default&#9;</xsl:text>
       <xsl:choose>
-        <xsl:when test="contains(../name,'xorg')">
+        <xsl:when test="contains(../name,'xorg') or
+                        contains(../name,'plasma') or
+                        contains(../name,'kf5')">
           <xsl:text>y
 
Index: BLFS/xsl/gen_pkg_list.xsl
===================================================================
--- BLFS/xsl/gen_pkg_list.xsl	(revision b39f283e3d5de90f3e1e12bda88c3f5f49be2c5e)
+++ BLFS/xsl/gen_pkg_list.xsl	(revision 0cd09c69545e2bae0bea15333bc97f0a2ec452d6)
@@ -360,5 +360,7 @@
         <xsl:when test="@role='nodep'"/>
 <!-- Call list expansion when we have an xorg7 series of packages -->
-        <xsl:when test="contains(@linkend,'xorg7-')">
+        <xsl:when test="contains(@linkend,'xorg7-') or
+                        @linkend='kf5-frameworks' or
+                        @linkend='plasma5-build'">
           <xsl:call-template name="expand-deps">
             <xsl:with-param name="section">
Index: BLFS/xsl/make_book.xsl
===================================================================
--- BLFS/xsl/make_book.xsl	(revision b39f283e3d5de90f3e1e12bda88c3f5f49be2c5e)
+++ BLFS/xsl/make_book.xsl	(revision 0cd09c69545e2bae0bea15333bc97f0a2ec452d6)
@@ -58,7 +58,5 @@
      Normally, those items are id of nodes.
      Those nodes can be sect1 (normal case),
-     sect2 (python modules or DBus bindings)
-     bridgehead (perl modules)
-     para (dependency of perl modules).
+     sect2 (python/perl modules/dependencies )
      The templates after this one treat each of those cases.
      However, some items are xorg package names, and not id.
@@ -66,5 +64,5 @@
      The difficulty is that some of those names *are* id's,
      because they are referenced in the index.
-     Hopefully, none of those id's are sect{1,2}, bridgehead or para...-->
+     Hopefully, none of those id's are sect{1,2}...-->
   <xsl:template name="apply-list">
     <xsl:param name="list" select="''"/>
@@ -101,5 +99,5 @@
             </xsl:when>
             <xsl:when test="contains(concat($list,' '),'-pass1 ')">
-<!-- We need to do it only for sect1 and sect2, because of libva -->
+<!-- We need to do it for both sect1 and sect2, because of libva -->
               <xsl:variable
                    name="real-id"
@@ -114,7 +112,9 @@
             <xsl:when test="not(id($list)[self::sect1 or self::sect2 or self::para or self::bridgehead])">
               <xsl:apply-templates
-                   select="//sect1[contains(@id,'xorg7')
-                               and contains(string(.//userinput),
-                                            concat($list,'-'))]"
+                select="//sect1[(contains(@id,'xorg7') or
+                                 contains(@id,'frameworks') or
+                                 contains(@id,'plasma5'))
+                                 and .//userinput/literal[contains(string(),
+                                            concat($list,'-'))]]"
                    mode="xorg">
                 <xsl:with-param name="package" select="$list"/>
@@ -498,4 +498,15 @@
   <xsl:template match="sect1" mode="xorg">
     <xsl:param name="package"/>
+    <!--DEBUG
+    <xsl:message>
+      <xsl:text>Entering sect1 template in xorg mode:
+- page id:</xsl:text>
+      <xsl:value-of select="@id"/>
+      <xsl:text>
+- package:</xsl:text>
+      <xsl:value-of select="$package"/>
+      <xsl:text>
+</xsl:text>
+    </xsl:message> END DEBUG -->
     <xsl:variable name="tarball">
       <xsl:call-template name="tarball">
@@ -522,5 +533,11 @@
       <xsl:call-template name="inst-instr">
         <xsl:with-param name="inst-instr"
-                        select=".//userinput[starts-with(string(),'for ')]"/>
+          select=
+            "substring-after(
+               substring-after(.//userinput[starts-with(string(),'for ') or
+                                            starts-with(string(),'while ')],
+                               'pushd'),
+               '&#xA;')"/>
+        <xsl:with-param name="package" select="$package"/>
       </xsl:call-template>
     </xsl:variable>
@@ -541,4 +558,8 @@
                    select=".//para[contains(string(),'(HTTP)')]/ulink/@url"/>
                 <xsl:value-of select="$download-dir"/>
+                <xsl:if test="contains(@id,'frameworks') or
+                              contains(@id,'plasma5')">
+                  <xsl:text>/</xsl:text>
+                </xsl:if>
                 <xsl:value-of select="$tarball"/>
               </xsl:attribute>
@@ -547,12 +568,5 @@
           </listitem>
           <listitem>
-            <para>Download (FTP): <xsl:element name="ulink">
-              <xsl:attribute name="url">
-                <xsl:value-of
-                   select=".//para[contains(string(),'(FTP)')]/ulink/@url"/>
-                <xsl:value-of select="$download-dir"/>
-                <xsl:value-of select="$tarball"/>
-              </xsl:attribute>
-             </xsl:element>
+            <para>Download (FTP): <ulink url=" "/>
             </para>
           </listitem>
@@ -582,5 +596,7 @@
         <screen><userinput>packagedir=<xsl:value-of
                     select="substring-before($tarball,'.tar.')"/>
-          <xsl:text>&#xA;</xsl:text>
+          <xsl:text>
+     name=$(echo $pkg | sed 's/-[[:digit:]].*//')
+          </xsl:text>
           <xsl:value-of select="substring-before($install-instructions,
                                                  'as_root')"/>
@@ -681,12 +697,19 @@
   <xsl:template name="inst-instr">
     <xsl:param name="inst-instr"/>
-    <xsl:choose>
-      <xsl:when test="contains($inst-instr,'pushd')">
-        <xsl:call-template name="inst-instr">
-          <xsl:with-param name="inst-instr"
-                          select="substring-after(
-                                   substring-after($inst-instr,'pushd'),
-                                   '&#xA;')"/>
-        </xsl:call-template>
+    <xsl:param name="package"/>
+    <xsl:choose>
+      <xsl:when test="contains(substring-after($inst-instr,'popd'),'popd')">
+        <xsl:choose>
+          <xsl:when test="$package='kapidox'">
+            <xsl:copy-of select="substring-after(substring-before($inst-instr,'popd'),'kapidox)')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:copy-of select="substring-before($inst-instr,'kapidox)')"/>
+            <xsl:call-template name="inst-instr">
+              <xsl:with-param name="inst-instr"
+                              select="substring-after($inst-instr,';;')"/>
+            </xsl:call-template>
+          </xsl:otherwise>
+        </xsl:choose>
       </xsl:when>
       <xsl:otherwise>
