Expected attribute value

38 views
Skip to first unread message

Pat

unread,
Sep 21, 2020, 8:59:20 AM9/21/20
to XSpec
Hello again!

I'm testing that an XSL-FO table is generated correctly; one of my tests is:

<x:expect label="second finding in table should link to 'finding2'"
            test="/fo:block[1]/fo:table[1]/fo:table-body[1]/fo:table-row[3]/fo:table-cell[1]/fo:block[1]/fo:basic-link[1]/@internal-destination">finding2</x:expect>

I would expect the XPath to resolve to the value 'finding2', however in the test report I see it is compared to a 'pseudo-attribute' element:

XPath /*/@* from:

<pseudo-attribute xmlns:fo="http://www.w3.org/1999/XSL/Format" internal-destination="finding2" />

Is this how one tests attribute values (should I set my expected value to this element) or is something weird going on?

AirQuick

unread,
Sep 21, 2020, 9:57:18 AM9/21/20
to xspec...@googlegroups.com
I guess the left-hand side report looks like this:

> Result
> XPath /*/@* from:
> <pseudo-attribute ... />

and the right-hand side report looks like this:

> Expected Result
> XPath /text() from:
> finding2

Note "/*/@*" and "/text()" in "XPath ... from". So, the actual result of
your stylesheet (filtered by x:expect/@test) was an attribute node while
you expected a text node.
(<psuedo-attribute> is a pseudo representation of an attribute. See
"<pseudo-*>" in
https://github.com/xspec/xspec/wiki/Understanding-Test-Results#pseudo- )

An attribute node and a text node are different node types even if their
values are the same. That's why the test is Failure.

If you write <x:expect> as follows, the test will be Success because
this time both the actual result and the expected result are strings:

<x:expect
test=".../@internal-destination/string()"
select="'finding2'" />

or

<x:expect
test=".../@internal-destination/string()"
select="string()">finding2</x:expect>

Another option would be to expect an attribute node:

<x:expect
test=".../@internal-destination"
select="e/@*">
<e internal-destination="finding2" />
</x:expect>


A similar case is discussed in "Difference in XPath ... from" in
https://github.com/xspec/xspec/wiki/Understanding-Test-Results#difference-in-xpath--from
.

--
AirQuick
> --
> You received this message because you are subscribed to the Google
> Groups "XSpec" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to xspec-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/xspec-users/75ed1ab7-215e-4642-8ee8-383876051e12n%40googlegroups.com.

Patricia Piolon

unread,
Sep 21, 2020, 10:29:20 AM9/21/20
to xspec...@googlegroups.com
Wow, okay. I did search, I promise!

Thanks again,
-- Patricia


Reply all
Reply to author
Forward
0 new messages