Nimbin[12]?Mirrors & Forks / jhalfs / commits / 6ac0d96

jhalfs git · trunk

jhalfs LFS build automation (mirror)

lfs mirror bash · first commit 2005-09-11 · last commit 2024-02-13 (2 years ago) · synced 3 days ago · upstream: git.linuxfromscratch.org/jhalfs

Python 78.4% Shell 19.8% Makefile 1.8%
git clone https://git.christianimmanuel.de/mirrors-forks/jhalfs.gitwget https://git.christianimmanuel.de/mirrors-forks/jhalfs/archive/jhalfs.tar.gz

outputpkgdest: fix the case of several <literal>

Pierre Labastie · 2023-03-19 09:10 · 6ac0d96300ab74cd7c21d8cd73ed327425d9e07b

We output text()[1], literal (literally), text(2). This does
not work if there are several <literal> tags. Change it to
outputing preceding-sibling::text()[1], literal for each
literal tag, then output text()[last()] (which works also
when there are no literal tag, so it removes a choose.
 BLFS/xsl/scripts.xsl | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/BLFS/xsl/scripts.xsl b/BLFS/xsl/scripts.xsl
index eb04609..d5d0fa3 100644
--- a/BLFS/xsl/scripts.xsl
+++ b/BLFS/xsl/scripts.xsl
@@ -930,22 +930,15 @@ echo Size after install: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG
   <xsl:template match="userinput" mode="destdir">
     <xsl:text>
 </xsl:text>
-    <xsl:choose>
-      <xsl:when test="./literal">
-        <xsl:call-template name="outputpkgdest">
-          <xsl:with-param name="outputstring" select="text()[1]"/>
-        </xsl:call-template>
-        <xsl:apply-templates select="literal"/>
-        <xsl:call-template name="outputpkgdest">
-          <xsl:with-param name="outputstring" select="text()[2]"/>
-        </xsl:call-template>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:call-template name="outputpkgdest">
-          <xsl:with-param name="outputstring" select="string()"/>
-        </xsl:call-template>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:for-each select="./literal">
+      <xsl:call-template name="outputpkgdest">
+        <xsl:with-param name="outputstring" select="preceding-sibling::text()[1]"/>
+      </xsl:call-template>
+      <xsl:apply-templates select="."/>
+    </xsl:for-each>
+    <xsl:call-template name="outputpkgdest">
+      <xsl:with-param name="outputstring" select="text()[last()]"/>
+    </xsl:call-template>
   </xsl:template>
 
   <xsl:template name="outputpkgdest">