Code Monkey home page Code Monkey logo

oxygen-xml-editor-xspec-support's Introduction

AppVeyor Build status Azure Pipelines Build Status GitHub Actions Test Workflow Status GitHub Actions Lint Workflow Status

XSpec Release

XSpec is a unit test and behaviour-driven development (BDD) framework for XSLT, XQuery, and Schematron. It is based on the Spec framework of RSpec, which is a BDD framework for Ruby.

XSpec consists of a syntax for describing the behaviour of XSLT, XQuery, or Schematron code, and some code that enables you to test the code against those descriptions.

Getting Started

To get started, check out the installation instructions for macOS/Linux and Windows and how to write your first XSpec test.

Support

Check out the XSpec documentation in the wiki before raising an issue or asking a question. If you have any question that is not answered in the wiki, feel free to raise an issue. For historical searches, the unmonitored XSpec discussion list might also be useful.

Contribute

XSpec is an open source project originally written by Jeni Tennison. It was maintained in the past years by Florent Georges. Active development of XSpec restarted in 2016 and the project is currently maintained by AirQuick, Amanda Galtman (technical development) and Sandro Cirulli (management and community) with the help of the XSpec community.

If you wish to contribute to XSpec, please read the contributing guidelines and then raise or pick up an issue and send us your pull requests. Please document any issue with examples of your XSpec code.

License

XSpec code is released under the MIT License. Few parts of the codebase are released under the Mozilla Public License.

The content of the XSpec wiki is released under the Creative Commons 3.0 BY license.

oxygen-xml-editor-xspec-support's People

Contributors

airquick avatar alexjitianu avatar dependabot[bot] avatar jelovirt avatar sorincarbunaru avatar stevenhiggs avatar tofi86 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oxygen-xml-editor-xspec-support's Issues

Pack the required XSpec framework as an add-on

The plugin requires an XSpec framework with a preconfigured transformation scenario. To make sure this framework is always loaded I could pack it as an add-on. The user will be able to install both the add-on and the plugin.

Diff action shows a "/" in first line

Testcase: xspec/xspec#227

The test fails for whatever reasons will come up in the named issue.

However, when clicking the "Diff" button, the oXygen Diff shows a / character in the first line of "expected", which isn't contained in the expected file:

bildschirmfoto 2018-07-24 um 12 54 01

"Show" doesn't always work correctly for Schematron x:expect-* elements

How to reproduce the problem in Oxygen 26.1:

  1. Open an XSpec test for a Schematron schema in which a scenario contains <x:expect-valid> and <x:expect-assert>.
  2. Duplicate the <x:expect-assert>, including all its attributes, in the same XSpec file. For instance, copy the element and paste it into another scenario.
  3. Click Run XSpec test scenarios to run the test.
  4. In the XSpec Test Results window, click Show next to the listing for valid. The <x:expect-valid> element should be selected, but it isn't.
  5. Click Show next to each of the <x:expect-assert> elements. They both select the first instance of this element in the XSpec file, instead of selecting the corresponding instance.

The issue with <x:expect-assert> seems to affect <x:expect-report>, <x:expect-not-assert>, <x:expect-not-report>, and <x:expect-rule> as well.

Sample XSpec scenarios, just to make it concrete

  <x:scenario label="Scenario 1">
    <x:context>
      <foo/>
    </x:context>
    <x:expect-not-assert id="abc"/>
    <x:expect-not-report/>
    <x:expect-valid/>
  </x:scenario>
  <x:scenario label="Scenario 2">
    <x:context>
      <bar/>
    </x:context>
    <x:expect-not-report/>
    <x:expect-not-assert id="abc"/>
  </x:scenario>

(Perhaps everything fails in the example above, depending on your schema, but I don't think the pass/fail status affects the "Show" behavior I'm seeing.)

Type error of $params in generate-xspec-tests-oxygen.xsl

With the latest master branch of this add-on, running xspec-xmlns.xspec (you can find it in XSpec repository) fails:

     [java] Type error evaluating (x:distinct-variable-names(...)!<xsl:param {(attr{name=...}, ...)}/>) on line 82 column 69 of generate-xspec-tests-oxygen.xsl:
     [java]   XTTE0570: The required item type of the value of variable $params is element(Q{}param);
     [java]   the supplied value <xsl:param> does not match. The node has the wrong name

Looks like

should have had xmlns="", that is,

<param name="{ @name }" select="${ @name }" xmlns=""> 

because this line was copied from generate-common-tests.xsl where the default namespace is different from generate-xspec-tests-oxygen.xsl.

XML Diff Viewer with capitals in element names

Issue taken over from another GitHub project, but still present:

When I use the Diff function to compare the expected with the current result in the Oxygen XML Diff Viewer, all element names was converted into lower case.

This is my scenario:

<x:scenario label="test">
	<x:context>
		<CAPS>CAPS</CAPS>
	</x:context>
	<x:expect label="identity result">
		<Caps>CAPS</Caps>
	</x:expect>
</x:scenario>

I get in the Oxygen XML Diff:

As result:

<caps>CAPS</caps>

As expected:

<caps>CAPS</caps>

Failing an attribute scenario generates error in unit-report-oxygen.xsl

Hi,

Given the following named template:

<xsl:template name="code-to-code" as="attribute()+">
        <xsl:param name="value" as="attribute(value)" select="."/>
        <xsl:param name="codeMap" as="element()*"/>
               
        <xsl:variable name="out" as="element()">
            <xsl:choose>
                <xsl:when test="$codeMap[@inValue = $value]">
                    <xsl:copy-of select="$codeMap[@inValue = $value]"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:copy-of select="."/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        
        <xsl:attribute name="code" select="$out/@code"/>
        <xsl:attribute name="codeSystem" select="$out/@codeSystem"/>
        <xsl:if test="$out/@displayName">
            <xsl:attribute name="displayName" select="$out/@displayName"/>
        </xsl:if>
    </xsl:template>

with the following scenario:

<x:scenario label="template name code-to-code">
            <x:call template="code-to-code">
                <x:param name="value" select="f:gender/@value">
                    <f:gender value="female"/>
                </x:param>
                <x:param name="codeMap">
                    <map code="F" codeSystem="null" inValue="female" displayName="Vrouw"/>
                </x:param>
            </x:call>
            <x:expect label="attributes" select="geslacht/@*">
                <geslacht code="F" codeSystem="null" displayName="Vrouw"/>
            </x:expect>
        </x:scenario>

The test succeeds and everything goed as planned. However, when I change the expect to fail the scenario:

<x:expect label="attributes" select="geslacht/@*">
                <geslacht code="false" codeSystem="2.16.840.1.113883.5.1" displayName="Vrouw"/>
            </x:expect>

The following error is raied in unit-report-oxygen.xsl:
[xslt] [...]\xspec.support-1.6.0\oxygen-results-view\unit-report-oxygen.xsl:192:0: Fatal Error! Cannot create an attribute node (code) whose parent is a document node. Most recent element start tag was output at line -1 of module *unknown*
Please let me know if I can clarify something.

Allow "XSpec Run" from the view

Feedback from @jelovirt on Slack:

Can’t make those plugins work. I installed both, they report as “installed” in the add-on admin and what I get is just this. I do see the new "XSpec Report" transtype, but when I run it, it completes successfully and nothing is shown in the new XSpec window.

So the view should be able to run the first xspec all by itself.

unable to validate xspec file

Hi team,

After update the latest version of xspec framework on oxygen i am unable to validate this.

Kindly check the below logs and suggest how to resolve this issue.

Executing:
"c:\program files\oxygen xml editor 21\jre/bin/java" -Dfile.encoding=UTF-8 -Xmx256m -classpath "C:\Program Files\Oxygen XML Editor 21\tools\ant/lib/ant-launcher.jar" "-Dant.home=C:\Program Files\Oxygen XML Editor 21\tools\ant" org.apache.tools.ant.launch.Launcher -lib "C:\Program Files\Oxygen XML Editor 21\classes" -lib "C:\Program Files\Oxygen XML Editor 21\lib\oxygenCommons.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\oxygen.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\oxygenDeveloper.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\oxygenEclipse.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\oxygenDeveloperEclipse.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\oxygen-sandbox.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\oxygen-license.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\oxygen-basic-utilities.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\oxygen-editor-variables-parser.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\xml-apis.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\oxygen-patched-resolver.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\oxygen-patched-saxon-9.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\saxon9-sql.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\log4j.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\oxygen-patched-xerces.jar" -lib "C:\Program Files\Oxygen XML Editor 21\lib\guava-23.0.jar" -f "oxygen-results-view/build_report.xml" "-Dcatalog=C:\Users\a-anilpx\Documents\OxygenXMLEditor\samples/catalog.xml" "-Dclean.output.dir=false" "-Dext.xspec.compiler.xsl=C:/Users/a-anilpx/AppData/Roaming/com.oxygenxml/extensions/v21.1/frameworks/https___www.oxygenxml.com_InstData_Addons_community_updateSite.xml/xspec.support-1.5.0/oxygen-results-view/generate-xspec-tests-oxygen.xsl" "-Dtest.type=t" "-Dxspec.fail=false" "-Dxspec.html.reporter.xsl=C:/Users/a-anilpx/AppData/Roaming/com.oxygenxml/extensions/v21.1/frameworks/https___www.oxygenxml.com_InstData_Addons_community_updateSite.xml/xspec.support-1.5.0/oxygen-results-view/unit-report-oxygen.xsl" "-Dxspec.project.dir=C:/Users/a-anilpx/AppData/Roaming/com.oxygenxml/extensions/v21.1/frameworks/https___www.oxygenxml.com_InstData_Addons_community_updateSite.xml/xspec.support-1.5.0/" "-Dxspec.result.html=C:\Program Files\Oxygen XML Editor 21\samples\xspec\xslt/escape-for-regex-report.html" "-Dxspec.template.name.entrypoint=${xspec.template.name.entrypoint}" "-Dxspec.xml=C:\Program Files\Oxygen XML Editor 21\samples\xspec\xslt\escape-for-regex.xspec" "-Dwebhelp.trial.license=yes"

Buildfile: C:\Users\a-anilpx\AppData\Roaming\com.oxygenxml\extensions\v21.1\frameworks\https___www.oxygenxml.com_InstData_Addons_community_updateSite.xml\xspec.support-1.5.0\oxygen-results-view\build_report.xml

BUILD FAILED
Property xspec.template.name.entrypoint was circularly defined.

Total time: 0 seconds

The process finished with exit code: 1

oXygen 20.1: XSpec transformation scenario fails

In oXygen 20.1 the built in transformation scenario for XSpec fails with a message mentioning the XSpec plugin directory.

ERROR
Executing:
"c:\program files\oxygen xml editor 20\jre/bin/java" -Dfile.encoding=UTF-8 -Xmx256m -classpath "C:\Program Files\Oxygen XML Editor 20\tools\ant/lib/ant-launcher.jar" "-Dant.home=C:\Program Files\Oxygen XML Editor 20\tools\ant" org.apache.tools.ant.launch.Launcher -lib "C:\Program Files\Oxygen XML Editor 20\classes" -lib "C:\Program Files\Oxygen XML Editor 20\lib\oxygen.jar" -lib "C:\Program Files\Oxygen XML Editor 20\lib\oxygenAuthor.jar" -lib "C:\Program Files\Oxygen XML Editor 20\lib\oxygenDeveloper.jar" -lib "C:\Program Files\Oxygen XML Editor 20\lib\oxygenEclipse.jar" -lib "C:\Program Files\Oxygen XML Editor 20\lib\oxygenAuthorEclipse.jar" -lib "C:\Program Files\Oxygen XML Editor 20\lib\oxygenDeveloperEclipse.jar" -lib "C:\Program Files\Oxygen XML Editor 20\lib\xml-apis.jar" -lib "C:\Program Files\Oxygen XML Editor 20\lib\resolver.jar" -lib "C:\Program Files\Oxygen XML Editor 20\lib\saxon9ee.jar" -lib "C:\Program Files\Oxygen XML Editor 20\lib\log4j.jar" -lib "C:\Program Files\Oxygen XML Editor 20\lib\xercesImpl.jar" -lib "C:\Program Files\Oxygen XML Editor 20\lib\guava-23.0.jar" -f "build.xml" "-Dcatalog=C:\Users\pagina\parsx3\oxygen-framework\oxygen\xpr-projektdateien\pagina\pc/catalog.xml" "-Dclean.output.dir=false" "-Dtest.type=t" "-Dxspec.fail=false" "-Dxspec.project.dir=C:/Users/pagina/AppData/Roaming/com.oxygenxml/extensions/v20.1/frameworks/https___raw.githubusercontent.com_xspec_oXygen_XML_editor_xspec_support_master_build_update_site.xml/xspec.support-1.0.0/" "-Dxspec.result.html=C:\Users\pagina\GitHub\xspec-test\test/docbook-to-html-result.html" "-Dxspec.xml=C:\Users\pagina\GitHub\xspec-test\test\docbook-to-html.xspec" "-Dwebhelp.trial.license=no"

Buildfile: C:\Users\pagina\AppData\Roaming\com.oxygenxml\extensions\v20.1\frameworks\https___raw.githubusercontent.com_xspec_oXygen_XML_editor_xspec_support_master_build_update_site.xml\xspec.support-1.0.0\build.xml

locateSchematron:

getSchematronPhase:

compileSchematron:

xspec:
     [echo] Creating Test Stylesheet...
     [xslt] Processing C:\Users\pagina\GitHub\xspec-test\test\docbook-to-html.xspec to C:\Users\pagina\GitHub\xspec-test\test\xspec\docbook-to-html.xsl
     [xslt] Loading stylesheet C:\Users\pagina\AppData\Roaming\com.oxygenxml\extensions\v20.1\frameworks\https___raw.githubusercontent.com_xspec_oXygen_XML_editor_xspec_support_master_build_update_site.xml\xspec.support-1.0.0\src\compiler\generate-xspec-tests.xsl

BUILD FAILED
C:\Users\pagina\AppData\Roaming\com.oxygenxml\extensions\v20.1\frameworks\https___raw.githubusercontent.com_xspec_oXygen_XML_editor_xspec_support_master_build_update_site.xml\xspec.support-1.0.0\build.xml:257: java.lang.NoClassDefFoundError: ro/sync/basic/util/Crypto
	at ro.sync.xml.transformer.n.f(Unknown Source)
	at ro.sync.xml.transformer.saxonee.SaxonEEUtilImpl.supplySaxonLicenseAndSchemaResolver(Unknown Source)
	at net.sf.saxon.Configuration.newConfiguration(Unknown Source)
	at net.sf.saxon.s9api.Processor.<init>(Processor.java:66)
	at net.sf.saxon.jaxp.SaxonTransformerFactory.<init>(Unknown Source)
	at net.sf.saxon.TransformerFactoryImpl.<init>(TransformerFactoryImpl.java:46)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at org.apache.tools.ant.taskdefs.optional.TraXLiaison.getFactory(TraXLiaison.java:427)
	at org.apache.tools.ant.taskdefs.optional.TraXLiaison.getSource(TraXLiaison.java:257)
	at org.apache.tools.ant.taskdefs.optional.TraXLiaison.readTemplates(TraXLiaison.java:309)
	at org.apache.tools.ant.taskdefs.optional.TraXLiaison.createTransformer(TraXLiaison.java:328)
	at org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:188)
	at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:881)
	at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:419)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.Target.performTasks(Target.java:456)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
	at org.apache.tools.ant.Main.runBuild(Main.java:857)
	at org.apache.tools.ant.Main.startAnt(Main.java:236)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:113)
Caused by: java.lang.ClassNotFoundException: ro.sync.basic.util.Crypto
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	... 34 more

Total time: 0 seconds

The process finished with exit code: 1


/cc @hschmull @duenckel

Warning reported when plugin is started

0 FATAL [ main ] ro.sync.exml.plugin.PluginContributedComponent - The initial index specified in the plugin.xml for component id 'com.oxygenxml.xspec.results' should take an integer value but was:

oxygen XML Developer - No license file found for saxon

I used in the past the version 0.0.4 from this GitHub project. It worked fine, but I had some issues (#1 and #2 from this project).

Now I discovered, that here is a newer version of the same plugin/framework. I updated and have now more issues. :-(

One issue I could isolate:
If you are using oXygen XML Developer version 18.1 you get the message "No license file found", so Saxon is running in HE version. In the full version or in 19.0 it works.

testing maps

The following test succeeds when run from the command line using XSpec pulled from the master branch of the GitHub repo (Latest commit 4c50caa; SAXON HE 9.9.1.4), but fails in <oXygen/> 21.1, build 2019101513 with version XSpec 1.2.1 of the add-on (both Framework and Helper view). The error message, from Ant, reads "FOTY0013: Maps cannot be atomized". The test is:

<x:scenario label="Scenario for testing function tokenize_input with two one-word inputs">
    <x:call function="djb:tokenize_input">
        <x:param name="s1" select="'kittens'"/>
        <x:param name="s2" select="'sitting'"/>
    </x:call>
    <x:expect label="Two one-word inputs are okay"
        select='            
        map{
        "left":("s","i","t","t","i","n","g"),
        "top":("k","i","t","t","e","n","s"),
        "type":"characters"
        }'
    />
</x:scenario>

and the function is:

<xsl:function name="djb:tokenize_input" as="map(xs:string, item()+)">
    <xsl:param name="top" as="xs:string"/>
    <xsl:param name="left" as="xs:string"/>
    <!-- *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
    <!-- validate input                                        -->
    <!-- no null strings                                       -->
    <!-- both strings must be either single  or multiple-word  -->
    <!-- *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
    <!-- normalize whitespace first                            -->
    <!-- *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
    <xsl:variable name="top_n" as="xs:string" select="normalize-space($top)"/>
    <xsl:variable name="left_n" as="xs:string" select="normalize-space($left)"/>

    <!-- *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
    <!-- check for mismatch parameter types                    -->
    <!-- *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
    <xsl:if test="(string-length($top_n), string-length($left_n)) = 0">
        <xsl:message select="'Null strings are not permitted'" terminate="yes"/>
    </xsl:if>
    <xsl:if
        test="
        not(
        (matches($top_n, '\s') and matches($left_n, '\s'))
        or
        not(matches($top_n, '\s')) and not(matches($left_n, '\s'))
        )">
        <xsl:message
            select="'Either both strings must be single words or both strings must be multiple words'"
            terminate="yes"/>
    </xsl:if>


    <!-- *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
    <!-- split the inputs                                      -->
    <!-- *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
    <xsl:variable name="top_out" as="xs:string+"
        select="
        if (matches($top_n, '\s')) then
        tokenize($top_n, '\s+')
        else
        for $c in string-to-codepoints($top_n)
        return
        codepoints-to-string($c)"/>
    <xsl:variable name="left_out" as="xs:string+"
        select="
        if (matches($left_n, '\s')) then
        tokenize($left_n, '\s+')
        else
        for $c in string-to-codepoints($left_n)
        return
        codepoints-to-string($c)"/>

    <!-- *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
    <!-- are we returning characters or words?                 -->
    <!-- *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
    <xsl:variable name="input_type" as="xs:string+"
        select="
        if (matches($top_n, '\s')) then
        'words'
        else
        'characters'"/>

    <!-- *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
    <!-- return tokenized sequences and type in map            -->
    <!-- *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* -->
    <xsl:sequence
        select="
        map {
        'top': $top_out,
        'left': $left_out,
        'type': $input_type
        }"
    />
</xsl:function>

Synopsis: The point of the function is to accept either two one-word inputs or two multi-word inputs (both as single strings; the multi-word ones are identified by internal whitespace). With one-word inputs, it should split the string into single-character strings. With multi-word inputs, it should word-tokenize the inputs on white space. It returns a map with three items: the sequences for each of the two inputs and a report on whether it split into characters or words. It should trap any input that isn't two single words or two multi-word strings, either as a type error on the parameter or by checking performed inside the function.

Error XTSE0660: Duplicate named template

This error occurs any time, if there are two scenarios with the same label in one XSpec file.

Well, for example:

<x:scenario label="test 1">
    
</x:scenario>
<x:scenario label="test 1">
    
</x:scenario>

The error occurs independently of the position or level of the scenarios. For instance they can also be nested into other scenarios.

This happens with the plugin only. The XSpec standard transformation scenario works fine with this.

Tested in oXygen versions 19.0 and 18.1 (both full & developer)

Show transform log

I'm using XSpec to test new XSLT code as I develop it.

I use xsl:message for debugging.

When I run the XSpec using a transform scenario I can set the "show log" setting to "Always" but I don't see a way to do that with the XSpec view, so I don't see the console log when I use it to run the tests. This limits the utility of the add-on, which is otherwise very handy.

"XPath ... from" is missing

Save these files on a local disk.

Open xpath-from.xspec in Oxygen. Run it with the XSpec Helper view add-on.
The test scenario should fail. Now, click the Q-Diff button. You can't see what is different between Result and Expected.
missing-xpath-from
Result is an element node while Expected is a document node. That's the difference, but this critical information is missing.

If you run the same test scenario with the native XSpec, you'll see the difference as in https://github.com/xspec/xspec/wiki/images/xpath-from.png.

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

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>

x:expect in xspec

How can we Handle multiple xpath relate to one node contain many child in one scenario and how to execute them.

http://www.uspto.gov/trademarks/teas/index.jsp www.lawandarts.co.uk

xpath:
1: test/url[1]/remotelink[1]
2: test/url[2]/remotelink[1][child::emph]

Xspec scenario:

<x:scenario label="testing of url/remotelink to url (id-CCCC-10464)">
<x:context select="/CASEDOC/docinfo[1]/url[1]/remotelink[1] or /CASEDOC/docinfo[1]/url[2]/remotelink[1][child::emph]" href="test.xml">
</x:context>
<x:expect label="testing of url/remotelink to url (id-CCCC-10464)">
http://www.uspto.gov/trademarks/teas/index.jsp
</x:expect>
<x:expect label="testing of url/remotelink/emph to url (id-CCCC-10464)">
www.lawandarts.co.uk
</x:expect>

</x:scenario> 

"XSpec Run" doesn't work on Mac OS X. and this is a patch.

--- build_report.xml.original	2017-11-30 14:23:09.000000000 +0900
+++ build_report.xml	2017-11-30 16:46:22.000000000 +0900
@@ -170,7 +170,7 @@
   	      <arg value="-xsl:${compile.xspec.xsl.driver}" />
   		
   		<arg value="xspec.template.name.entrypoint=${xspec.template.name.entrypoint}" />
-  		<arg value="compiled-stylesheet-uri=file:/${xspec.xsl}" />
+  		<arg value="compiled-stylesheet-uri=${xspec.xsl}" />
   	    	
   	      <arg value="-config:${xspec.saxon.config}" />
   	    </java>

Running a Schematron test from the view shows no results

I have an XSpec that tests a Schematron file. I execute it and I see some results in the view. if I use the upper most Run button from the view, the one next to the schematron's name, after the execution is finish I see nothing in the view.

XSLT error results in empty pane

If the tested XSLT produces an error (e.g. because of a document($uri) function where the $uri can't be accessed) the result pane is empty, no error is thrown and you have no chance to debug but install xspec as standalone application.

This happens with latest release, tested yesterday.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.