Actions
Bug #3467
closedDifference in evaluation between PE and EE (Saxon 9.7.0.20)
Start date:
2017-10-03
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
9.7, 9.8, trunk
Fix Committed on Branch:
9.7, 9.8, trunk
Description
One of our users posted an example here:
https://www.oxygenxml.com/forum/post44286.html#p44283
So the test.xml is:
<root filePath="../../../grammars/efl/infoCommentaire/xf_infoCommentaire.srng"/>
and the test.xsl is:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:els="http://www.lefebvre-sarrut.eu/ns/els"
xmlns:functx="http://www.functx.com"
exclude-result-prefixes="#all"
version="2.0">
<!--<xsl:include href="functx.xsl"/>-->
<!--==========================================-->
<!--MAIN-->
<!--==========================================-->
<xsl:template match="/*">
<xsl:value-of select="els:getFileName(@filePath)"/>
</xsl:template>
<!--==========================================-->
<!--FUNCTIONS-->
<!--==========================================-->
<xsl:function name="els:getFileName" as="xs:string">
<xsl:param name="filePath" as="xs:string?"/>
<xsl:param name="withExt" as="xs:boolean"/>
<xsl:variable name="fileNameWithExt" select="functx:substring-after-last-match($filePath,'/')"/>
<xsl:variable name="fileNameNoExt" select="functx:substring-before-last-match($fileNameWithExt,'\.')"/>
<!--DEBUG-->
<xsl:message>filePath = <xsl:value-of select="$filePath"/></xsl:message>
<xsl:variable name="localString" select="'../../../grammars/efl/infoCommentaire/xf_infoCommentaire.srng'" as="xs:string"/>
<xsl:message>$localString = $filePath is <xsl:value-of select="$localString = $filePath"/></xsl:message>
<xsl:message>test1 (with $filePath) = <xsl:value-of select="functx:substring-after-last-match($filePath,'/')"/></xsl:message>
<xsl:message>test2 (with $localString) = <xsl:value-of select="functx:substring-after-last-match($localString,'/')"/></xsl:message>
<!--/DEBUG-->
<xsl:variable name="ext" select="els:getFileExt($fileNameWithExt)"/>
<xsl:sequence select="concat('', $fileNameNoExt, if ($withExt) then (concat('.',$ext)) else (''))"/>
</xsl:function>
<!--1 arg signature-->
<xsl:function name="els:getFileName" as="xs:string">
<xsl:param name="filePath" as="xs:string?"/>
<xsl:sequence select="els:getFileName($filePath,true())"/>
</xsl:function>
<xsl:function name="els:getFileExt" as="xs:string">
<xsl:param name="filePath" as="xs:string?"/>
<xsl:sequence select="concat('',functx:substring-after-last-match($filePath,'\.'))"/>
</xsl:function>
<!--==========================================-->
<!--FUNCTX (copy of used functions)-->
<!--==========================================-->
<xsl:function xmlns:functx="http://www.functx.com" name="functx:substring-after-last-match" as="xs:string">
<xsl:param name="arg" as="xs:string?"/>
<xsl:param name="regex" as="xs:string"/>
<xsl:sequence select=" replace($arg,concat('^.*',$regex),'') "/>
</xsl:function>
<xsl:function xmlns:functx="http://www.functx.com" name="functx:substring-before-last-match" as="xs:string?">
<xsl:param name="arg" as="xs:string?"/>
<xsl:param name="regex" as="xs:string"/>
<xsl:sequence select=" replace($arg,concat('^(.*)',$regex,'.*'),'$1') "/>
</xsl:function>
</xsl:stylesheet>
Running Saxon EE from the command line you obtain:
<?xml version="1.0" encoding="UTF-8"?>srng.srng
but running Saxon PE you obtain:
<?xml version="1.0" encoding="UTF-8"?>xf_infoCommentaire.srng
Please register to edit this issue
Actions