hi group,
I use xspec always to test bug fixes on my company's style sheet. They helped me a lot, especially when it comes to old features: some 'fixes' appear to break them. And this is revealed by the old xspec tests. A real life saver.
One of the last bug fixes was in the template with match='/'.
It looks that this template is never executed by xspec and there is no way to activate it. Is this true? I have written a small test to show the problem:
stylesheet:<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:template match="/">
<document>
<xsl:apply-templates/>
</document>
</xsl:template>
<xsl:template match="phrases">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="phrase">
<phrase><xsl:apply-templates/></phrase>
</xsl:template>
</xsl:stylesheet>
xspec test:<?xml version="1.0" encoding="UTF-8"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec"
stylesheet="d.xslt">
<x:scenario label="When processing a list of phrases">
<x:context>
<phrases>
<phrase>Hello!</phrase>
</phrases>
</x:context>
<!-- check the result -->
<x:expect label="document element should be added">
<document>
<phrase status="same">Hello!</phrase>
</document>
</x:expect>
</x:scenario>
</x:description>
What I try to test here is the code in the match='/' template. So the addding of node 'document'. But this test fails, because the template is not executed by xspec.
I expect it is simply not possible. My next question is: is there a way to change the stylesheet so that xspec can test the underlying code just the same?
What do you do to test the
whole stylesheet?
thanks for your insights, Ruud