xspec / oXygen-XML-editor-xspec-support

An oxygen XML Editor plugin intended to help those that create XSpec scenarios.
MIT License
11 stars 10 forks source link

Basic XSLT 3.0 isn't working in XSpec but is in Oxygen. #23

Closed YvonneArnoldus closed 6 years ago

YvonneArnoldus commented 6 years ago

I've upgraded identity transform form XSLT 2.0 to XLST 3.0 for performance reasons in my xsl file. When I run the XSpec test on the command line the test is still successful, when I run the same test in XSpec plugin in Oxygen it fails. When i run the xml and xsl through Oxygen debugger it produces the correct result.

XSL:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
    version="3.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:deltaxml="http://www.deltaxml.com/ns/well-formed-delta-v1"
    xmlns:tei="http://www.tei-c.org/ns/1.0"
    exclude-result-prefixes="#all">
    <!-- 
        This transformation is MGG specific:
        Generates identities for the <head/> elements based on their parent.
    -->

    <!-- 
        identity transform:
        Copies an element node and does apply-templates to its attributes and children
    -->
    <xsl:mode on-no-match="shallow-copy"/>

    <xsl:template match="tei:head">
        <xsl:copy>
            <xsl:attribute name="deltaxml:key" select="concat(../@xml:id, '-head')"/>
            <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
    </xsl:template>

</xsl:stylesheet>

XSpec test:

<?xml version="1.0" encoding="UTF-8"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec"
    stylesheet="pre_flattening_mgg_generate_head_identity.xsl"
    xmlns:deltaxml="http://www.deltaxml.com/ns/well-formed-delta-v1">
    <x:scenario label="Scenario for testing xsl:mode on-no-match='shallow-copy'">
        <x:context>
            <TEI xsi:schemaLocation="http://www.tei-c.org/ns/1.0 http://rilm.info/ft/schema/mgg/tei_rilm.xsd" xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <text xml:id="mgg15295" type="topic" xml:lang="de-DE-1996">
                    <body>
                        <div type="section" xml:id="id-72e9023c-6710-a99b-e72b-96291ed9c765" n="IV">
                        </div>
                    </body>
                </text>
            </TEI>
        </x:context>
        <x:expect label="Copy all element nodes and apply-templates to its attributes and children">
            <TEI xsi:schemaLocation="http://www.tei-c.org/ns/1.0 http://rilm.info/ft/schema/mgg/tei_rilm.xsd" xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <text xml:id="mgg15295" type="topic" xml:lang="de-DE-1996">
                    <body>
                        <div type="section" xml:id="id-72e9023c-6710-a99b-e72b-96291ed9c765" n="IV">
                        </div>
                    </body>
                </text>
            </TEI>
        </x:expect>
    </x:scenario>

    <x:scenario label="Scenario for testing template with match 'tei:head">
        <x:context>
            <TEI xsi:schemaLocation="http://www.tei-c.org/ns/1.0 http://rilm.info/ft/schema/mgg/tei_rilm.xsd" xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <text xml:id="mgg15295" type="topic" xml:lang="de-DE-1996">
                    <body>
                        <div type="section" xml:id="id-72e9023c-6710-a99b-e72b-96291ed9c765" n="IV">
                            <head n="IV">20.</head>
                        </div>
                    </body>
                </text>
            </TEI>
        </x:context>
        <x:expect label="Copy attribute xml:id from div to head attribute deltaxml:key and postfix with '-head'">
            <TEI xsi:schemaLocation="http://www.tei-c.org/ns/1.0 http://rilm.info/ft/schema/mgg/tei_rilm.xsd" xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <text xml:id="mgg15295" type="topic" xml:lang="de-DE-1996">
                    <body>
                        <div type="section" xml:id="id-72e9023c-6710-a99b-e72b-96291ed9c765" n="IV">
                            <head deltaxml:key="id-72e9023c-6710-a99b-e72b-96291ed9c765-head" n="IV">20.</head>
                        </div>
                    </body>
                </text>
            </TEI>
        </x:expect>
    </x:scenario>
</x:description>
AlexJitianu commented 6 years ago

Hello,

I've tried the samples you have provided and I managed to execute the XSpec test successfully using version 1.0.1 of the plugin.

What version of Oxygen are you running? When the execution fails, do you get an error log? The error log normally appears in the results area of Oxygen in a tab named ANT [Xpec Report]. If you don't see such a tab, please locate and click this icon in the right area of the status bar: image It should present the aforementioned tab. Please post here the content of the log and maybe we can see something of use it it.

Best regards, Alex

YvonneArnoldus commented 6 years ago

Hi,

I was using Oxygen 19.1 with the 0.11 version of XSpec. So it seems to be solved with the lastest version of Oxygen and XSpec.

I made a work around by using the XSpec command line to run the tests and never tried Oxygen with XSpec again.

AlexJitianu commented 6 years ago

Hi, it is probably something that was fixed in one of the later builds. I tested Oxygen 19.1 with version 1.0.1 of the plugin (the latest version) and it also worked.