XSpec error

Having trouble installing Oxygen? Got a bug to report? Post it all here.
scottbdr
Posts: 50
Joined: Tue Jul 21, 2009 1:48 am

XSpec error

Post by scottbdr »

Hi, I'm struggling a bit with an error produced running an XSpec on my Schematron. The Schematron runs successfully against an instance, but when I run the XSpec it errors out: "XPDY0002: The context item for axis step root/Document is absent." I have isolated this to a variable defined in the pattern that selects an element value from the instance being validated:

Code: Select all

        
        <sch:let name="statusFilter" value=" if(//status = ('production','sample')) 
                then ('stable','deprecated')  else ('unstable','stable','deprecated')   " />
 
$statusFilter then gets used in another variable where the error actually pops up. When I make $statusFilter just a sequence of string values (@value="'stable','deprecated'"), the XSpec runs. I've attached the items in question (just unzip and fix the RegistryPath var as appropriate), any help would be appreciated. (let me know if the attachment didn't work - couldn't tell if it did or not).
xspec-error.7z
(24.17 KiB) Downloaded 133 times
scottbdr
Posts: 50
Joined: Tue Jul 21, 2009 1:48 am

Re: XSpec error

Post by scottbdr »

After reviewing some of the details of the XSpec documentation this weekend I found the issue. Seems that you must set the XSpec x:documentation/@run-as attribute to "external" for the global context item to be the x:context content. This would seem to be a good default to have, however not fully understanding what else it impacts (it's 'experimental' according to the docs) I guess it's just something to be aware of when you have global variables outside of a rule context. Hope this helps someone else who runs into the problem - it certainly stumped me for a long while!

Thanks, Scott

https://github.com/xspec/xspec/wiki/Ext ... ntext-item
alex_jitianu
Posts: 1009
Joined: Wed Nov 16, 2005 11:11 am

Re: XSpec error

Post by alex_jitianu »

Hi Scott,

Thank you for sharing this with the Oxygen community. Indeed, "export" does sound as a good default value, but the people from the XSpec community probably know better. You can record an issue to change the default and see what they have to say about it: https://github.com/xspec/xspec/issues

Best regards,
Alex
kwun
Posts: 12
Joined: Fri Mar 04, 2022 12:27 pm

Re: XSpec error

Post by kwun »

Allow me to ask a similar question, yet a little different:

my local testing environment is rather easy:
I have a directory in which my xsl as well as the acompanying xpsec file reside:
let's name them tei-transcript.xsl and tei-transcript.xspec, wich are the names they actually have.

I get the following error upon attempting to have the tei-transcript.xspec executed:
System-ID: /home/kevin/Dokumente/pa000008/xsl/tei-transcript.xspec
Umwandlung: Run XSpec Test
Build-Datei: /home/kevin/Dokumente/pa000008/xsl/build.xml
Dokumenttypen: XSpec
Programmname: ANT
Fehlerlevel: fatal
Beschreibung: Transformation failed. /home/kevin/.com.oxygenxml/extensions/v24.1/frameworks/com.oxygenxml.xspec.XSpecSupportFramework/xspec.support-2.2.6/build.xml:443: Java returned: 2
the code of the xspec is rather easy at the moment, tis is neither a minimal reproducable example nor am I missing sth., I just wanted to start implementing tests for XSL today:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec"
    xmlns:tei="http://www.tei-c.org/ns/1.0" stylesheet="tei-transcript.xsl"
    >
    <x:scenario label="Scenario for testing function lb">
        <x:call template="tei:lb"/>
        <x:expect label="Not yet implemented" select="'Not yet implemented'"/>
    </x:scenario>
</x:description>
The actual XSL contains a single template

Code: Select all

<template match="tei:lb"/>
were I count all <lb>-elements annd output them in html-<span class="lineNumber">.

Any hints, or should I open a new thread?
scottbdr
Posts: 50
Joined: Tue Jul 21, 2009 1:48 am

Re: XSpec error

Post by scottbdr »

You might want a new thread for this... I haven't done XSLT testing with XSpec yet but you might try the @run-as="external" on <x:description> just to see if something changes. I have yet to figure out what exactly it does but it has solved some XSpec problems for me. You might also want to try a XSLT template that's not completely empty. Just my thoughts... sometimes you just have to try stuff until it works :) I definitely recommend using XSpec - it works great even if it's a bit tricky to use sometimes. Good luck!

Scott
alex_jitianu
Posts: 1009
Joined: Wed Nov 16, 2005 11:11 am

Re: XSpec error

Post by alex_jitianu »

Hi,

When the XSpec fails there are two tabs opened. One of them has the name ANT [Run XSpec Test] and contains the transformation log. In it you can find additional information about why it failed.
At a glance, it looks like you have a match template so you need to create a matching scenario. Only if you have a named template, for example

Code: Select all

<xsl:template name="tei:lib">
can you call it like this:

Code: Select all

<x:call template="tei:lb"/> 
Best regards,
Alex
Post Reply