Florent, you now have MANY entries to check !
Best regards,
Christophe
Le 20/02/2016 20:30, CIRULLI, Sandro a écrit :
Hi,
I posted a comment on the XSpec issue tracker related to this patch
(https://github.com/expath/xspec/pull/74), I copy-paste it here below.
Best,
Sandro
I tested the support for testing XSLT 3.0 with this XSpec test:
<?xmlversion="1.0"encoding="UTF-8"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec"
stylesheet="unit-converter.xsl" xslt-version="3.0">
<x:scenario label="When processing a data element with unit feet">
<x:context>
<data>
<altitude>1200</altitude>
<unit>feet</unit>
</data>
</x:context>
<x:expect label="convert feet to meters">
<data>
<altitude>365.76</altitude>
<unit>meters</unit>
</data>
</x:expect>
</x:scenario>
</x:description>
It tests the following XSLT which makes use of high-order functions, a
new feature of XSLT 3.0 (the example is adapted from
www.xfront.com/Pearls-of-XSLT-and-XPath-3-0-Design.pdf
<http://www.xfront.com/Pearls-of-XSLT-and-XPath-3-0-Design.pdf>).
<?xmlversion="1.0"encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
exclude-result-prefixes="xs math"
version="3.0">
<xsl:variable name="unit-converter"
select="function(
$value as xs:decimal,
$f as function(item()*) as item()*
)
as xs:decimal
{$f($value)}"/>
<xsl:variable name="feet-to-meters"
select="function(
$a as xs:decimal
)
as xs:decimal
{$a * 0.3048}"/>
<xsl:template match="data[unit='feet']">
<xsl:copy>
<altitude>
<xsl:value-of select="$unit-converter(altitude,
$feet-to-meters)"/>
</altitude>
<unit>meters</unit>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
I run this test with Oxygen 14.2 (which includes the Oxygen patch) and
the test goes through successfully. However, I noticed that with this
patch it is compulsory to specify the |@xslt-version|with the value
'3.0' when testing an XSLT 3.0. If the attribute is not provided, the
Oxygen ant file complains that XPath 3.0 is needed to run the test.
If the patch is changed from:
<stylesheet version="{( @xslt-version, '2.0' )[1]}">
to:
<stylesheet version="{if ( @xslt-version, '3.0' ) then '3' else '2'}">
the XSpec test runs correctly even if |@xslt-version| is not provided.
I wonder if this implementation may be more suitable as it does not
force to specify the |@xslt-version| in the XSpec test, one only needs
to specify the XSLT version in the actual XSL stylesheet. It also
seems to me more consistent when writing XSpec tests for XSLT 2.0 as
it is not required to specify |@xslt-version| in the XSpec test.
Unfortunately I'm unable to test this implementation when running
XSpec from the command line as XSLT 3.0 requires saxon9ee.jar (I only
have saxon9he.jar available).
Oxford University Press (UK) Disclaimer
This message is confidential. You should not copy it or disclose its
contents to anyone. You may use and apply the information for the
intended purpose only. OUP does not accept legal responsibility for
the contents of this message. Any views or opinions presented are
those of the author only and not of OUP. If this email has come to you
in error, please delete it, along with any attachments. Please note
that OUP may intercept incoming and outgoing email communications.
_______________________________________________
oXygen-user mailing list
[email protected]
https://www.oxygenxml.com/mailman/listinfo/oxygen-user
_______________________________________________
oXygen-user mailing list
[email protected]
https://www.oxygenxml.com/mailman/listinfo/oxygen-user