Page 1 of 1

Prefixes in results in Xspec HTML report

Posted: Sat Aug 06, 2016 1:44 pm
by Alekso
Hi all,

Does anybody know how to hide prefixes in HTML report? Please check attached picture https://photos.google.com/share/AF1QipM ... ppWkkyTkpn

As you can see there I want to compare value in one segment but instead of I have also all prefixes there.
How to use @href @select and @test correctly, if I want to see only comparable segments and their values without any prefixes?

Please share with me if you know.
Thank you in advance!

Alekso

Re: Prefixes in results in Xspec HTML report

Posted: Wed Aug 10, 2016 12:50 pm
by radu_pisoi
Hi,

Unfortunately I don't know any option that can be used to hide prefixes in HTML report generated by XSpec.

Could you address this question to the XSpec project? I guess the guys that manage this project might have a solution for this problem.
https://github.com/expath/xspec

Re: Prefixes in results in Xspec HTML report

Posted: Wed Aug 10, 2016 1:05 pm
by Alekso
radu_pisoi wrote:Hi,

Unfortunately I don't know any option that can be used to hide prefixes in HTML report generated by XSpec.

Could you address this question to the XSpec project? I guess the guys that manage this project might have a solution for this problem.
https://github.com/expath/xspec

Hi,

Thanks for your reply I will ask them then.

Br,
Alekso

Re: Prefixes in results in Xspec HTML report

Posted: Sun Aug 21, 2016 3:25 pm
by cirulls
Hi,

I can't see a way to hide prefixes in XSpec but you can use @select and nested scenarios to achieve something similar. Say you have this XML as starting point:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<Segment_Identifier xmlns:pkg="http://expath.org/ns/pkg" xmlns:impl="urn:x-xspec:compile:xslt:impl" xmlns:tllaa="tllaa">R000</Segment_Identifier>
and you want to apply this simple identity transform in your XSLT:

Code: Select all


<?xml version="1.0" ?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- IdentityTransform -->
<xsl:template match="/ | @* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
you can run this XSpec test with @select in the contexts and a nested scenario:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" stylesheet="prefix.xsl">

<x:scenario label="When processing <Segment_Identifier>">
<x:context href="prefix.xml" select="Segment_Identifier"/>

<x:scenario label="and extracting its text node">
<x:context select="node()/text()"/>

<x:expect label="the value should match">R001</x:expect>
</x:scenario>

</x:scenario>
</x:description>
which will give you this HTML report:

https://gist.githubusercontent.com/ciru ... prefix.png

The first context selects only the element Segment_Identifier, this allows you to show in the report which element is tested. The nested scenario inherits the context from the first scenario and select its text node which is finally compared in the expect part.

Note that with this workaround you have to write a test for each element you want to test in order to identify in the HTML report which element has the wrong value. Alternatively, you can replace in the first context Segment_Identifier with the more general node(). This will allow you to test every node with a single test but you won't know in the HTML report which element has the wrong value, you'll just see there is a wrong value in one of the elements.

Hope it helps...

Sandro

Re: Prefixes in results in Xspec HTML report

Posted: Mon Aug 22, 2016 7:27 pm
by Alekso
cirulls wrote:Hi,

I can't see a way to hide prefixes in XSpec but you can use @select and nested scenarios to achieve something similar. Say you have this XML as starting point:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<Segment_Identifier xmlns:pkg="http://expath.org/ns/pkg" xmlns:impl="urn:x-xspec:compile:xslt:impl" xmlns:tllaa="tllaa">R000</Segment_Identifier>
and you want to apply this simple identity transform in your XSLT:

Code: Select all


<?xml version="1.0" ?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- IdentityTransform -->
<xsl:template match="/ | @* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
you can run this XSpec test with @select in the contexts and a nested scenario:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" stylesheet="prefix.xsl">

<x:scenario label="When processing <Segment_Identifier>">
<x:context href="prefix.xml" select="Segment_Identifier"/>

<x:scenario label="and extracting its text node">
<x:context select="node()/text()"/>

<x:expect label="the value should match">R001</x:expect>
</x:scenario>

</x:scenario>
</x:description>
which will give you this HTML report:

https://gist.githubusercontent.com/ciru ... prefix.png

The first context selects only the element Segment_Identifier, this allows you to show in the report which element is tested. The nested scenario inherits the context from the first scenario and select its text node which is finally compared in the expect part.

Note that with this workaround you have to write a test for each element you want to test in order to identify in the HTML report which element has the wrong value. Alternatively, you can replace in the first context Segment_Identifier with the more general node(). This will allow you to test every node with a single test but you won't know in the HTML report which element has the wrong value, you'll just see there is a wrong value in one of the elements.

Hope it helps...

Sandro

Hi Sandro!

You're right, currently I will use this approach when I want to compare results in some segments. Of course it is better than nothing.
Thanks for your help!

Alekso