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

[Question] Using a test helper module with external transformation #1706

Open
vdeygas opened this issue Apr 14, 2023 · 4 comments
Open

[Question] Using a test helper module with external transformation #1706

vdeygas opened this issue Apr 14, 2023 · 4 comments

Comments

@vdeygas
Copy link

vdeygas commented Apr 14, 2023

Hello

I'd like to run Xspec with @run-as="external" and <x:helper stylesheet="helper.xsl" />

It seems that my helper module is not included.

Is it possible to do this ?

Thanks!

@vdeygas vdeygas changed the title [Question] Usinge a test helper module with external transformation [Question] Using a test helper module with external transformation Apr 14, 2023
@AirQuick
Copy link
Member

With @run-as="external", helper modules are not included while running your stylesheets being tested. They are included only when setting up test parameters (such as x:call/x:param/@select and x:context/@select) or inspecting test results (such as x:expect/(@select|@test).

See the x:helper and @run-as="external" section in Wiki.

@galtm
Copy link
Collaborator

galtm commented Aug 10, 2023

Hi, @vdeygas .
Do you have any follow-up questions about your helper module, or was the answer from @AirQuick sufficient?

@vdeygas
Copy link
Author

vdeygas commented Aug 16, 2023

I have one follow-up question.

Is the feature planned or considered on your roadmap ?

It would be convenient to include helper modules running run Xspec with @run-as="external".

@galtm
Copy link
Collaborator

galtm commented Oct 4, 2023

Hi, @vdeygas .

When your XSpec test runs an external transformation, there is a deliberate separation between XSpec and the code you are testing. The helper module is included on the XSpec side -- just not on the XSLT side.

If we were to make the helper module available to the XSLT code being tested in an external transformation, I doubt it would be the default interaction of the helper and external features. I expect that some users want to avoid having their helper module "leak into" the system they're testing, and that's part of why they're using run-as="external".

Would either of these alternatives work for your situation, instead of using <x:helper>?

A) Include the helper module in the stylesheet you're testing. Perhaps the helper module contains functions and moded templates that you can be sure will never be invoked except from XSpec.

B) Create a test harness stylesheet that includes/imports both your real stylesheet and your helper module, and configure the XSpec file to point to the test harness stylesheet rather than your real stylesheet. This arrangement is depicted in the following section of a conference paper related to XSpec: High-Level File Structure to Enable Substitution. The use case in that paper is slightly different from your situation, but the diagram of the architecture is the same.

If not, can you say more about your situation to help us suggest other alternatives or design/prioritize a potential enhancement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants