[Om] tiny patch to CD XSLT code

Dima dima_nadya at 013net.net
Mon Apr 25 20:24:33 CEST 2011


Hi,
  I have the following tiny patch relative to the OpenMath SVN. The
patch replaces a Java call with a native XSLT2.0 function, used for
testing existence of a given file. The rationale is that reference
implementation of OpenMath standard should not assume that XSLT
processor is Java based. Moreover, the Java call does not work with
**Home Edition of Saxon** (see postscriptum).


Index: www/cdfiles2/xsl/cd.xsl
===================================================================
--- www/cdfiles2/xsl/cd.xsl   (revision 1217)
+++ www/cdfiles2/xsl/cd.xsl   (working copy)
@@ -437,9 +437,9 @@
 

-<xsl:template name="test-file-exists" xmlns:file="java.io.File">
+<xsl:template name="test-file-exists">
   <xsl:param name="filename" select="'x'"/>
-  <xsl:value-of select="file:exists(file:new(string($filename)))"/>
+  <xsl:value-of select="unparsed-text-available($filename)"/>
 </xsl:template>



  If this patch will be accepted, similar change should be done in
`www/cdfiles2/xsl/cdnames.xsl'.

Thanks, regards,
  Dima.

P.S.
  Running Openmath with Home Edition of Saxon 9.3 gave the error
descibed below. After applying my patch the error disappeared, and I
have succeeded to compile nice xhtml pages like on
http://www.openmath.org/cd/calculus1.xhtml .

*** VIA SAXON JAR ***
$ java -jar Saxon/archives/saxon9he.jar calculus1.ocd
OpenMath-SVN/www/cdfiles2/xsl/cd.xsl 
Warning: Stylesheet module
file:/media/disk1/math-notation/OpenMath-SVN/www/cdfiles2/xsl/verb.xsl
is included or imported more than once. This is permitted, but may lead
to errors or unexpected behavior
Error at xsl:value-of on line 442 column 68 of cd.xsl:
  XPST0017 XPath syntax error at char 12 on line 442 near
{...s(file:new(string($filename...}:
    Cannot find a matching 1-argument function named
{java.io.File}new(). Note that direct
  calls to Java methods are not available under Saxon-HE
Failed to compile stylesheet. 1 error detected.


*** VIA DEBIAN (SID) PACKAGE OF SAXON ***
$ saxonb-xslt -s:calculus1.ocd -xsl:OpenMath-SVN/www/cdfiles2/xsl/cd.xsl
-o:p.xml
Error at xsl:value-of on line 442 of
file:/media/disk1/math-notation/OpenMath-SVN/www/cdfiles2/xsl/cd.xsl:
  XPST0017: XPath syntax error at char 39 on line 442 in
{...s(file:new(string($filename...}:
    Cannot find a matching 1-argument function named
{java.io.File}new(). Note: external
  function calls have been disabled
Failed to compile stylesheet. 1 error detected.





More information about the Om mailing list