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

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

Closed jd-nictiz closed 4 years ago

jd-nictiz commented 4 years ago

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.

AlexJitianu commented 4 years ago

Hi,

Thank you for reporting this issue. I've released a new version, 1.6.1, that fixes this issue.