Index: BLFS/gen-special.sh
===================================================================
--- BLFS/gen-special.sh	(revision 5ed69f823f28db12a5f56eb709ed8446f5070df0)
+++ BLFS/gen-special.sh	(revision c801809bb075586e48f3ebf89ec4672c88fde1e9)
@@ -88,8 +88,9 @@
 done
 
-# Taking packages inside x7proto etc, as versionned modules.
+# Taking packages contained in pages installing several packages (x7* except
+# x7driver, kf5-frameworks, and plasma5-all), as versionned modules.
 # We also write a dependency expansion when a dep is of the form
-# xorg7-something. Since that is another template, we need
-# a temporary file, which we shall concatenate at the end
+# xorg7-something or kf5-frameworks or plasma5-build. Since that is another
+# template, we need a temporary file, which we shall concatenate at the end
 cat >tmpfile << EOF
   <xsl:template name="expand-deps">
@@ -99,5 +100,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
@@ -111,30 +114,29 @@
       <xsl:when test="\$section='$id'">
 EOF
-# We extract the list of packages for an xorg page from
-# the version part of the .xml file. Seems that
-# the order is not always the same as in the "cat" command.
-# So we have to read that command too, since it may be assumed
+# We extract the list of packages for those pages from
+# the "cat" command that creates the md5 file. We assume
 # 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\|#' |
-              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
+# note that some pages may have several "cat" command, so we have to
+# make a complex regex for the first line to save. All those lines have
+# .md5 in them except the one for x7legacy that has .dat.
+# we need also to remove lines beginning with #.
+# Note that only xorg pages have '&' in them. So for kde
+# pages, what is extracted it the full tarball name.
+list_cat="$(sed -n '/>cat.*\.\(md5\|dat\)/,/EOF</p' $file | \
+            grep -v 'cat\|EOF\|#' | \
+            awk '{ print $NF }' | sed 's/-&.*//')"
+
+  precpack=NONE
+  for pack in $list_cat; do
+    if grep -q x7 $file; then # this is an xorg package
+      packname=$pack
+# We extract the version from the ENTITY parts of the .xml file.
+      packversion=$(grep "ENTITY ${pack}-version" $file | \
+	            sed 's@[^"]*"\([^"]*\).*@\1@')
+    else
+      packname=${pack%-[[:digit:]]*}
+      packversion=$(echo $pack | sed 's/[^.]*-\([.[:digit:]]*\)\.tar.*/\1/')
+    fi
     cat >>$SPECIAL_FILE << EOF
         <module><xsl:text>&#xA;          </xsl:text>
Index: BLFS/xsl/gen_config.xsl
===================================================================
--- BLFS/xsl/gen_config.xsl	(revision 5ed69f823f28db12a5f56eb709ed8446f5070df0)
+++ BLFS/xsl/gen_config.xsl	(revision c801809bb075586e48f3ebf89ec4672c88fde1e9)
@@ -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 5ed69f823f28db12a5f56eb709ed8446f5070df0)
+++ BLFS/xsl/gen_pkg_list.xsl	(revision c801809bb075586e48f3ebf89ec4672c88fde1e9)
@@ -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 5ed69f823f28db12a5f56eb709ed8446f5070df0)
+++ BLFS/xsl/make_book.xsl	(revision c801809bb075586e48f3ebf89ec4672c88fde1e9)
@@ -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>
Index: BLFS/xsl/process-prompt.xsl
===================================================================
--- BLFS/xsl/process-prompt.xsl	(revision c801809bb075586e48f3ebf89ec4672c88fde1e9)
+++ BLFS/xsl/process-prompt.xsl	(revision c801809bb075586e48f3ebf89ec4672c88fde1e9)
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="1.0">
+
+  <xsl:template name="process-prompt">
+    <xsl:param name="instructions"/>
+    <xsl:param name="root-seen"/>
+    <xsl:param name="prompt-seen"/>
+
+<!-- Isolate the current instruction -->
+    <xsl:variable name="current-instr" select="$instructions[1]"/>
+
+    <xsl:choose>
+<!--============================================================-->
+<!-- First, if we have an empty tree, close everything and exit -->
+      <xsl:when test="not($current-instr)">
+        <xsl:if test="$prompt-seen">
+          <xsl:call-template name="end-prompt"/>
+        </xsl:if>
+        <xsl:if test="$root-seen">
+          <xsl:call-template name="end-root"/>
+        </xsl:if>
+      </xsl:when><!-- end empty tree -->
+<!--============================================================-->
+      <xsl:when test="$current-instr[@role='root']">
+        <xsl:choose>
+          <xsl:when test="$current-instr//prompt">
+            <xsl:if test="not($root-seen)">
+              <xsl:call-template name="begin-root"/>
+            </xsl:if>
+            <xsl:text>&#xA;</xsl:text>
+            <xsl:if test="not($prompt-seen)">
+              <xsl:copy-of
+                select="substring-before($current-instr//text()[1],'&#xA;')"/>
+              <xsl:text> &lt;&lt; PROMPT_EOF
+</xsl:text>
+            </xsl:if>
+            <xsl:apply-templates
+              select="$current-instr/userinput/node()[position()>1]"/>
+            <xsl:call-template name="process-prompt">
+              <xsl:with-param
+                 name="instructions"
+                 select="$instructions[position()>1]"/>
+              <xsl:with-param name="root-seen" select="boolean(1)"/>
+              <xsl:with-param name="prompt-seen" select="boolean(1)"/>
+            </xsl:call-template>
+          </xsl:when><!-- end prompt as root -->
+<!--____________________________________________________________ -->
+          <xsl:otherwise><!-- we have no prompt -->
+            <xsl:if test="$prompt-seen">
+              <xsl:text>
+quit
+PROMPT_EOF</xsl:text>
+            </xsl:if>
+            <xsl:apply-templates
+              select="$current-instr"
+              mode="config"/>
+            <!-- the above will call "end-root" if the next screen
+                 sibling is not role="root". We need to pass root-seen=false
+                 in this case. Otherwise, we need to pass root-seen=true.
+                 So create a variable -->
+            <xsl:variable name="rs"
+              select="$instructions[2][@role='root']"/>
+            <xsl:call-template name="process-prompt">
+              <xsl:with-param
+                 name="instructions"
+                 select="$instructions[position()>1]"/>
+              <xsl:with-param name="root-seen" select="boolean($rs)"/>
+              <xsl:with-param name="prompt-seen" select="boolean(0)"/>
+            </xsl:call-template>
+          </xsl:otherwise><!-- end no prompt -->
+<!--____________________________________________________________ -->
+        </xsl:choose>
+      </xsl:when><!-- role="root" -->
+<!--============================================================-->
+      <xsl:otherwise><!-- no role -->
+        <xsl:if test="$prompt-seen">
+          <xsl:text>
+quit
+PROMPT_EOF</xsl:text>
+        </xsl:if>
+        <xsl:if test="$root-seen">
+          <xsl:call-template name="end-root"/>
+        </xsl:if>
+        <xsl:apply-templates select="$current-instr/userinput"/>
+        <xsl:call-template name="process-prompt">
+          <xsl:with-param
+             name="instructions"
+             select="$instructions[position()>1]"/>
+          <xsl:with-param name="root-seen" select="boolean(0)"/>
+          <xsl:with-param name="prompt-seen" select="boolean(0)"/>
+        </xsl:call-template>
+      </xsl:otherwise><!-- no role -->
+<!--============================================================-->
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="prompt"/>
+</xsl:stylesheet>
Index: BLFS/xsl/process-replaceable.xsl
===================================================================
--- BLFS/xsl/process-replaceable.xsl	(revision 5ed69f823f28db12a5f56eb709ed8446f5070df0)
+++ BLFS/xsl/process-replaceable.xsl	(revision c801809bb075586e48f3ebf89ec4672c88fde1e9)
@@ -113,4 +113,7 @@
       <xsl:when test="string()='&lt;EXAMPLE.ORG&gt;'">
         <xsl:copy-of select="$DOMAINNAME"/>
+        <xsl:if test="contains(preceding-sibling::text()[1],'kdb5_util')">
+          <xsl:text> -P rtpw </xsl:text>
+        </xsl:if>
       </xsl:when>
       <xsl:when test="string()='&lt;example.org&gt;'">
@@ -123,4 +126,13 @@
       <xsl:when test="string()='&lt;loginname&gt;'">
         <xsl:text>$USER</xsl:text>
+        <xsl:if test="contains(preceding-sibling::text()[1],'-policy')">
+          <xsl:text> -pw mypw</xsl:text>
+        </xsl:if>
+        <xsl:if test="contains(preceding-sibling::text()[1],'kinit')">
+          <xsl:text> &lt;&lt; PASS_EOF
+mypw
+PASS_EOF
+</xsl:text>
+        </xsl:if>
       </xsl:when>
 <!-- for xorg environment. Note that libreoffice too uses &lt;PREFIX&gt; -->
Index: BLFS/xsl/scripts.xsl
===================================================================
--- BLFS/xsl/scripts.xsl	(revision 5ed69f823f28db12a5f56eb709ed8446f5070df0)
+++ BLFS/xsl/scripts.xsl	(revision c801809bb075586e48f3ebf89ec4672c88fde1e9)
@@ -80,4 +80,7 @@
 <!-- include the template for replaceable tags -->
   <xsl:include href="process-replaceable.xsl"/>
+
+<!-- include the template for prompt tags -->
+  <xsl:include href="process-prompt.xsl"/>
 
 <!--=================== Begin processing ========================-->
@@ -386,6 +389,19 @@
       <xsl:when test="@role = 'configuration'">
         <xsl:text>&#xA;</xsl:text>
-        <xsl:apply-templates mode="config"
-             select=".//screen[not(@role = 'nodump') and ./userinput]"/>
+        <xsl:choose>
+          <xsl:when test=".//screen/userinput/prompt">
+            <xsl:call-template name="process-prompt">
+              <xsl:with-param
+                name="instructions"
+                select=".//screen[not(@role = 'nodump') and ./userinput]"/>
+              <xsl:with-param name="root-seen" select="false"/>
+              <xsl:with-param name="prompt-seen" select="false"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates mode="config"
+                 select=".//screen[not(@role = 'nodump') and ./userinput]"/>
+          </xsl:otherwise>
+        </xsl:choose>
       </xsl:when><!-- @role="configuration" -->
 
