Skip to content

use-when attribute on external function calls #17

@sdm7g

Description

@sdm7g

I've only done this on two files so far. If I get a chance to do and test it more thoroughly, I will submit a pull for this feature.

I have been keeping a version of Oxygen 10 around for testing and debugging stylesheet changes, but even that is awkward at times.

I've discovered if I use the use-when attribute and function-available(), I can run stylesheets in current Oxygen 21.

diff --git a/style/textIndexer/common/preFilterCommon.xsl b/style/textIndexer/common/preFilterCommon.xsl
index 18aa772f..8a88c40f 100644
--- a/style/textIndexer/common/preFilterCommon.xsl
+++ b/style/textIndexer/common/preFilterCommon.xsl
@@ -48,7 +48,7 @@
       <xsl:variable name="docpath" select="saxon:system-id()"/>
       <xsl:variable name="base" select="replace($docpath, '(.*)\.[^\.]+$', '$1')"/>
       <xsl:variable name="dcpath" select="concat($base, '.dc.xml')"/>
-      <xsl:if test="FileUtils:exists($dcpath)">
+      <xsl:if use-when="function-available('FileUtils:exists')" test="FileUtils:exists($dcpath)">
          <xsl:apply-templates select="document($dcpath)" mode="inmeta"/>
          <xsl:if test="not(document($dcpath)//*:identifier)">
             <identifier xtf:meta="true" xtf:tokenize="no">
@@ -253,7 +253,7 @@
       
       <!-- Remove accent marks and other diacritics -->
       <xsl:variable name="no-accents-name">
-         <xsl:value-of select="CharUtils:applyAccentMap('../../../conf/accentFolding/accentMap.txt', $creator)"/>
+         <xsl:value-of use-when="function-available('CharUtils:applyAccentMap')" select="CharUtils:applyAccentMap('../../../conf/accentFolding/accentMap.txt', $creator)"/>
       </xsl:variable>
       
       <!-- Normalize Spaces & Case-->
@@ -461,7 +461,7 @@
       
       <!-- Remove accent marks and other diacritics -->
       <xsl:variable name="no-accents-name">
-         <xsl:value-of select="CharUtils:applyAccentMap('../../../conf/accentFolding/accentMap.txt', $string)"/>
+         <xsl:value-of use-when="function-available('CharUtils:applyAccentMap')" select="CharUtils:applyAccentMap('../../../conf/accentFolding/accentMap.txt', $string)"/>
       </xsl:variable>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions