Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source document at runtime should be removed #423

AirQuick opened this issue Nov 13, 2018 · 0 comments


None yet
1 participant
Copy link

commented Nov 13, 2018

Command line and Ant provide a source document when running the tests. But it can be harmful. For example,


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="" />


<?xml version="1.0" encoding="UTF-8"?>
<x:description stylesheet="do-nothing.xsl" xmlns:x="">
		<x:label>Suppose you're testing count() function with child::element() selected but you
			forget to provide the selection context (either inner XML or @href)</x:label>
		<x:call function="count">
			<x:param select="child::element()" />
		<x:expect label="and you happen to expect 1" select="1" />

This x:param doesn't make sense, but x:expect returns Success without any complaint, because x:param/@select is evaluated in the source document node of the .xspec file.
So the source document can be harmful.

The purpose of the source document is discussed in expath#73. No use case is presented there.
On the other hand, I have one use case:

	<x:call function="my:detect-text-encoding">
		<x:param select="
			=> resolve-uri(document-uri())
			=> saxon:read-binary-resource()" />

This way you can read the binary files relative to the .xspec file. I sometimes use this trick in my production XSpec files.

To sum up, I think

  • The source document at runtime can be harmful or confusing at best. Command line and Ant should remove it.
  • XSpec should provide an alternative way to get the URI of the .xspec file at runtime.

@AirQuick AirQuick added the bug label Nov 13, 2018

AirQuick added a commit that referenced this issue Apr 12, 2019

AirQuick added a commit that referenced this issue Apr 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.