Re: [xsl] RenderX XEP current date error

Subject: Re: [xsl] RenderX XEP current date error
From: "G. Ken Holman g.ken.holman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 6 Nov 2018 13:37:47 -0000
At 2018-11-06 12:58 +0000, Rahul Singh rahulsinghindia15@xxxxxxxxx wrote:
I have installed RenderX XEP and written XSL in
2.0 and trying to generate PDF but getting error
for current-date while same i have execute in Altova and that is working
fine:


C:\Program Files\RenderX\XEP>xep -xml Source.xml -xsl Source.xsl
(document [system-id Source.xml]
B  [error] Error in expression
substring-before(substring-after(string(current-date()),'-'),'-'):
Unknown system function: current-date; SystemID:
Source.xsl; Line#: 78; Column#: -1
B  [error]
javax.xml.transform.TransformerException: Error
in expression
substring-before(substring-after(string(current-date()),'-'),'-'):
Unknown system function: current-date
error: formatting failed:
javax.xml.transform.TransformerException: Error
in expression
substring-before(substring-after(string(current-date()),'-'),'-'):
Unknown system function: current-date

The error message says it all: the function you need is not available in the XSLT processor you are using.

Consider the below XSL-FO stylesheet that can make the check you need.

I hope this helps.

. . . . . Ken

~/y/samp $ xslt checkFor2.xsl checkFor2.xsl /dev/null

This stylesheet requires at least version 2.0 of XSLT to run.

Processing terminated by xsl:message at line 8
~/y/samp $ xslt2 checkFor2.xsl checkFor2.xsl /dev/null
~/y/samp $ cat checkFor2.xsl
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns="http://www.w3.org/1999/XSL/Format";
                version="2.0">

<xsl:template match="/">
  <xsl:if test="number(system-property('xsl:version')) &lt; 2.0">
    <xsl:message terminate="yes">
This stylesheet requires at least version 2.0 of XSLT to run.
    </xsl:message>
  </xsl:if>
<root font-family="Times" font-size="20pt">

  <layout-master-set>
    <simple-page-master master-name="frame"
                        page-height="297mm" page-width="210mm"
                        margin-top="15mm" margin-bottom="15mm"
                        margin-left="15mm" margin-right="15mm">
      <region-body region-name="frame-body"/>
    </simple-page-master>
  </layout-master-set>

  <page-sequence master-reference="frame">
    <flow flow-name="frame-body">
      <block>
        XSLT Processor:
        <xsl:value-of select="system-property('xsl:vendor')"/>
        <xsl:text> </xsl:text>
        <xsl:value-of select="system-property('xsl:vendor-url')"/>
      </block>
    </flow>
  </page-sequence>
</root>

</xsl:template>

</xsl:stylesheet>
~/y/samp $


-- Contact info, blog, articles, etc. http://www.CraneSoftwrights.com/s/ | Check our site for free XML, XSLT, XSL-FO and UBL developer resources | Streaming hands-on XSLT/XPath 2 training class @ US$45 (5 hours free) |

Current Thread