Author: Tj <debian@iam.tj>
Last-Update: 2025-08-16
Forwarded: not-needed
Description: Remove XSLT version 2.0 constructs due to libsaxon-java 
 < v8.9 only supporting version 1.0

diff --git a/demo/fo/cfg/fo/attrs/layout-masters-attr.xsl b/demo/fo/cfg/fo/attrs/layout-masters-attr.xsl
index d30bd9aae..3c35553c2 100644
--- a/demo/fo/cfg/fo/attrs/layout-masters-attr.xsl
+++ b/demo/fo/cfg/fo/attrs/layout-masters-attr.xsl
@@ -26,7 +26,7 @@
     <xsl:attribute name="margin-bottom">
       <xsl:value-of select="$page-margin-bottom"/>
     </xsl:attribute>
-    <xsl:attribute name="{if ($writing-mode = 'lr') then 'margin-left' else 'margin-right'}">
+    <xsl:attribute name="margin-left"><!--{if ($writing-mode = 'lr') then 'margin-left' else 'margin-right'}"-->
       <xsl:choose>
         <!-- support legacy parameter -->
         <xsl:when test="normalize-space($page-margin-left)">
@@ -40,7 +40,7 @@
         </xsl:otherwise>
       </xsl:choose>
     </xsl:attribute>
-    <xsl:attribute name="{if ($writing-mode = 'lr') then 'margin-right' else 'margin-left'}">
+    <xsl:attribute name="margin-right"><!--{if ($writing-mode = 'lr') then 'margin-right' else 'margin-left'}"-->
       <xsl:choose>
         <!-- support legacy parameter -->
         <xsl:when test="normalize-space($page-margin-right)">
@@ -63,7 +63,7 @@
     <xsl:attribute name="margin-bottom">
       <xsl:value-of select="$page-margin-bottom"/>
     </xsl:attribute>
-    <xsl:attribute name="{if ($writing-mode = 'lr') then 'margin-left' else 'margin-right'}">
+    <xsl:attribute name="margin-left"><!--{if ($writing-mode = 'lr') then 'margin-left' else 'margin-right'}"-->
       <xsl:choose>
         <!-- support legacy parameter -->
         <xsl:when test="normalize-space($page-margin-left)">
@@ -77,7 +77,7 @@
         </xsl:otherwise>
       </xsl:choose>
     </xsl:attribute>
-    <xsl:attribute name="{if ($writing-mode = 'lr') then 'margin-right' else 'margin-left'}">
+    <xsl:attribute name="margin-right"><!--{if ($writing-mode = 'lr') then 'margin-right' else 'margin-left'}"-->
       <xsl:choose>
         <!-- support legacy parameter -->
         <xsl:when test="normalize-space($page-margin-right)">
diff --git a/demo/fo/xsl/fo/bookmarks_1.0.xsl b/demo/fo/xsl/fo/bookmarks_1.0.xsl
index a9a5d08ea..b6bd9d474 100644
--- a/demo/fo/xsl/fo/bookmarks_1.0.xsl
+++ b/demo/fo/xsl/fo/bookmarks_1.0.xsl
@@ -119,7 +119,7 @@ See the accompanying license.txt file for applicable licenses.
           </xsl:otherwise>
         </xsl:choose>
       </xsl:variable>
-      <xsl:if test="exists($bookmarks)">
+      <xsl:if test="boolean($bookmarks)">
         <fo:bookmark-tree>
           <xsl:copy-of select="$bookmarks"/>
         </fo:bookmark-tree>
@@ -199,4 +199,4 @@ See the accompanying license.txt file for applicable licenses.
     <!--<xsl:template match="*[contains(@class, ' topic/topic ')][opentopic-func:determineTopicType() = 'topicIndexList']" mode="bookmark" priority="10"/>-->
 
 
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
diff --git a/demo/fo/xsl/fo/root-processing.xsl b/demo/fo/xsl/fo/root-processing.xsl
index 490ed49f7..9ef4dab9d 100644
--- a/demo/fo/xsl/fo/root-processing.xsl
+++ b/demo/fo/xsl/fo/root-processing.xsl
@@ -40,16 +40,16 @@ See the accompanying license.txt file for applicable licenses.
     exclude-result-prefixes="opentopic-index opentopic opentopic-i18n opentopic-func"
     version="2.0">
     
-    <xsl:param name="bookmap-order" select="'discard'"/>
+    <!--xsl:param name="bookmap-order" select="'discard'"/-->
   
-    <xsl:variable name="retain-bookmap-order" select="*[contains(@class,' bookmap/bookmap ')] and $bookmap-order eq 'retain'"/>
-    <xsl:variable name="writing-mode">
-      <xsl:variable name="lang" select="if (contains($locale, '_')) then substring-before($locale, '_') else $locale"/>
+    <xsl:variable name="retain-bookmap-order" select="*[contains(@class,' bookmap/bookmap ')]"/><!-- "and $bookmap-order eq 'retain'"-->
+    <xsl:variable name="writing-mode" select="'lr'"/>
+      <!--xsl:variable name="lang" select="if (contains($locale, '_')) then substring-before($locale, '_') else $locale"/>
       <xsl:choose>
         <xsl:when test="some $l in ('ar', 'fa', 'he', 'ps', 'ur') satisfies $l eq $lang">rl</xsl:when>
         <xsl:otherwise>lr</xsl:otherwise>
       </xsl:choose>
-    </xsl:variable>
+    </xsl:variable-->
     
     <xsl:variable name="layout-masters">
         <xsl:value-of select="'cfg:fo/layout-masters.xml'"/>
@@ -139,19 +139,19 @@ See the accompanying license.txt file for applicable licenses.
 
             <xsl:call-template name="createFrontMatter"/>
 
-            <xsl:if test="not($retain-bookmap-order)">
+            <!--xsl:if test="not($retain-bookmap-order)"-->
                 <xsl:call-template name="createToc"/>
-            </xsl:if>
+            <!--/xsl:if-->
 
 <!--            <xsl:call-template name="createPreface"/>-->
 
             <xsl:apply-templates/>
 
-            <xsl:if test="not($retain-bookmap-order)">
+            <!--xsl:if test="not($retain-bookmap-order)"-->
                 <xsl:call-template name="createIndex"/>
-            </xsl:if>
+            <!--/xsl:if-->
 
         </fo:root>
     </xsl:template>
 
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
diff --git a/demo/fo/xsl/fo/toc.xsl b/demo/fo/xsl/fo/toc.xsl
index a76cfc764..54660b9d8 100644
--- a/demo/fo/xsl/fo/toc.xsl
+++ b/demo/fo/xsl/fo/toc.xsl
@@ -219,7 +219,7 @@ See the accompanying license.txt file for applicable licenses.
     <xsl:template match="text()[. = 'topicChapter']" mode="toc-topic-text">
         <xsl:param name="tocItemContent"/>
         <xsl:param name="currentNode"/>
-        <xsl:for-each select="$currentNode">
+        <xsl:for-each select="saxon:node-set($currentNode)" xmlns:saxon="http://icl.com/saxon">
         <fo:block xsl:use-attribute-sets="__toc__chapter__content">
             <xsl:copy-of select="$tocItemContent"/>
         </fo:block>
@@ -229,7 +229,7 @@ See the accompanying license.txt file for applicable licenses.
     <xsl:template match="text()[. = 'topicAppendix']" mode="toc-topic-text">
         <xsl:param name="tocItemContent"/>
         <xsl:param name="currentNode"/>
-        <xsl:for-each select="$currentNode">
+        <xsl:for-each select="saxon:node-set($currentNode)" xmlns:saxon="http://icl.com/saxon">
         <fo:block xsl:use-attribute-sets="__toc__appendix__content">
             <xsl:copy-of select="$tocItemContent"/>
         </fo:block>
@@ -239,7 +239,7 @@ See the accompanying license.txt file for applicable licenses.
     <xsl:template match="text()[. = 'topicPart']" mode="toc-topic-text">
         <xsl:param name="tocItemContent"/>
         <xsl:param name="currentNode"/>
-        <xsl:for-each select="$currentNode">
+        <xsl:for-each select="saxon:node-set($currentNode)" xmlns:saxon="http://icl.com/saxon">
         <fo:block xsl:use-attribute-sets="__toc__part__content">
             <xsl:copy-of select="$tocItemContent"/>
         </fo:block>
@@ -249,7 +249,7 @@ See the accompanying license.txt file for applicable licenses.
     <xsl:template match="text()[. = 'topicPreface']" mode="toc-topic-text">
         <xsl:param name="tocItemContent"/>
         <xsl:param name="currentNode"/>
-        <xsl:for-each select="$currentNode">
+        <xsl:for-each select="saxon:node-set($currentNode)" xmlns:saxon="http://icl.com/saxon">
         <fo:block xsl:use-attribute-sets="__toc__preface__content">
             <xsl:copy-of select="$tocItemContent"/>
         </fo:block>
@@ -267,7 +267,7 @@ See the accompanying license.txt file for applicable licenses.
     <xsl:template match="node()" mode="toc-topic-text">
         <xsl:param name="tocItemContent"/>
         <xsl:param name="currentNode"/>
-        <xsl:for-each select="$currentNode">
+        <xsl:for-each select="saxon:node-set($currentNode)" xmlns:saxon="http://icl.com/saxon">
         <fo:block xsl:use-attribute-sets="__toc__topic__content">
             <xsl:copy-of select="$tocItemContent"/>
         </fo:block>
