help3xsl/online_transform.xsl |   66 ++++--------------------------------------
 1 file changed, 7 insertions(+), 59 deletions(-)

New commits:
commit 893489db23d56977dbc9f775ffdad9f83a5cde40
Author:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
AuthorDate: Mon Jun 20 23:22:27 2022 +0200
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Wed Jun 22 16:59:39 2022 +0200

    combine switch and switchinline template rules
    
    Change-Id: I4436c0da1b0443ab9e699aac75122368db8ab5a5
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/136198
    Tested-by: Jenkins
    Reviewed-by: Olivier Hallot <olivier.hal...@libreoffice.org>

diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl
index 3d6ba7387..fa28ad0ff 100644
--- a/help3xsl/online_transform.xsl
+++ b/help3xsl/online_transform.xsl
@@ -657,19 +657,14 @@
 
 </xsl:template>
 
-<!-- SWITCH -->
-<xsl:template match="switch">
+<!-- SWITCH and SWITCHINLINE -->
+<xsl:template match="switch|switchinline">
     <xsl:variable name="idsw">
         <xsl:value-of select="//meta/topic/@id" /><xsl:number level="any" 
count="switch|switchinline" format="_1"/>
     </xsl:variable>
     <xsl:choose>
-        <xsl:when test ="@select = 'sys'">
-            <span id="swlnsys{$idsw}" class="switch">
-                <xsl:apply-templates />
-            </span>
-        </xsl:when>
-        <xsl:when test ="@select = 'appl'">
-            <span id="swlnappl{$idsw}" class="switch">
+        <xsl:when test ="@select = 'sys' or @select = 'appl'">
+            <span id="swln{@select}{$idsw}" class="{local-name()}">
                 <xsl:apply-templates />
             </span>
         </xsl:when>
@@ -678,60 +673,13 @@
         </xsl:otherwise>
     </xsl:choose>
 </xsl:template>
-<xsl:template match="switch" mode="embedded">
-    <xsl:variable name="idsw">
-        <xsl:value-of select="//meta/topic/@id" /><xsl:number level="any" 
count="switch|switchinline" format="_1"/>
-    </xsl:variable>
-    <xsl:choose>
-        <xsl:when test ="@select = 'sys'">
-            <span id="swlnsys{$idsw}" class="switch">
-                <xsl:apply-templates mode="embedded"/>
-            </span>
-        </xsl:when>
-        <xsl:when test ="@select = 'appl'">
-            <span id="swlnappl{$idsw}" class="switch">
-                <xsl:apply-templates mode="embedded"/>
-            </span>
-        </xsl:when>
-        <xsl:otherwise>
-            <p class="debug" dir="auto">Unsupported switch condition.</p>
-        </xsl:otherwise>
-    </xsl:choose>
-</xsl:template>
-
-<!-- SWITCHINLINE -->
-<xsl:template match="switchinline">
+<xsl:template match="switch|switchinline" mode="embedded">
     <xsl:variable name="idsw">
         <xsl:value-of select="//meta/topic/@id" /><xsl:number level="any" 
count="switch|switchinline" format="_1"/>
     </xsl:variable>
     <xsl:choose>
-        <xsl:when test ="@select = 'sys'">
-            <span id="swlnsys{$idsw}" class="switchinline">
-                <xsl:apply-templates />
-            </span>
-        </xsl:when>
-        <xsl:when test ="@select = 'appl'">
-            <span id="swlnappl{$idsw}" class="switchinline">
-                <xsl:apply-templates />
-            </span>
-        </xsl:when>
-        <xsl:otherwise>
-            <p class="debug" dir="auto">Unsupported switch condition.</p>
-        </xsl:otherwise>
-    </xsl:choose>
-</xsl:template>
-<xsl:template match="switchinline" mode="embedded">
-    <xsl:variable name="idsw">
-        <xsl:value-of select="//meta/topic/@id" /><xsl:number level="any" 
count="switch|switchinline" format="_1"/>
-    </xsl:variable>
-    <xsl:choose>
-        <xsl:when test ="@select = 'sys'">
-            <span id="swlnsys{$idsw}" class="switchinline">
-                <xsl:apply-templates mode="embedded"/>
-            </span>
-        </xsl:when>
-        <xsl:when test ="@select = 'appl'">
-            <span id="swln{@select}_{$idsw}" class="switchinline">
+        <xsl:when test ="@select = 'sys' or @select = 'appl'">
+            <span id="swln{@select}{$idsw}" class="{local-name()}">
                 <xsl:apply-templates mode="embedded"/>
             </span>
         </xsl:when>

Reply via email to