calling template

77 views
Skip to first unread message

Johan Lindgren

unread,
Jun 1, 2016, 3:38:15 AM6/1/16
to XSpec
Hi,

I just found XSpec and started to try it out and so far I'm very impressed. Very useful.

But I came across a problem I can't figure out. 

In the xslt I'm writing tests for there is a call to a named template but with no parameter. The template works directly with xpath's on the xml document that is being transformed.

I'm using oXygen and build and run the xspec unit tests there.

I can add a context and load the xml I would like to use for testing.
But when using context I am not allowed to use call to call the named template.

Any ideas?
What am I missing?

Thanks

Johan

Sandro Cirulli

unread,
Jun 20, 2016, 2:23:25 AM6/20/16
to XSpec
Hi Johan,

thanks for your input and sorry for the late reply. It would be useful if you can post some code examples of what you're trying to do and what you expect to get. In the meantime I point you to the documentation for writing XSpec tests for named templates: https://github.com/expath/xspec/wiki/Writing-Scenarios#named-scenarios

I can see that the XSLT that generates the tests (https://github.com/expath/xspec/blob/master/src/compiler/generate-xspec-tests.xsl) does not allow to set a context and call a function (see error message 'can't set a context and call a function at the same time'). Named templates are conceptually similar to functions so I suspect this is an intended behaviour although I could not see an explicit error message for setting a context and calling a named template. But if you post an example I can see what comes out of it and if there is a workaround.

Thanks,

Sandro
Reply all
Reply to author
Forward
0 new messages