Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use-when attribute on external function calls #17

Open
sdm7g opened this issue Apr 25, 2019 · 0 comments
Open

use-when attribute on external function calls #17

sdm7g opened this issue Apr 25, 2019 · 0 comments

Comments

@sdm7g
Copy link

sdm7g commented Apr 25, 2019

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant