Modular XSLT stylesheets

17 views
Skip to first unread message

ol sp

unread,
Aug 31, 2021, 9:03:53 AM8/31/21
to xspec...@googlegroups.com
Hi, is there somewhere information how to use XSpec with XSLT stylesheets which have include/import? 

AirQuick

unread,
Aug 31, 2021, 10:55:20 PM8/31/21
to xspec...@googlegroups.com
If have A.xsl which includes/imports B.xsl

<xsl:stylesheet>
<xsl:include href="B.xsl" />
...Some functions and templates that depend on B.xsl...
</xsl:stylesheet>

then you can test A.xsl by just specifying it in
/x:description/@stylesheet:

<x:description stylesheet="A.xsl">
...Scenarios for testing functions/templates in A.xsl...
</x:description>


If A.xsl depends on B.xsl but A.xsl itself does not include/import B.xsl

<xsl:stylesheet>
...No xsl:include/xsl:import...
...Some functions and templates that depend on B.xsl...
</xsl:stylesheet>

then you can write a simple wrapper (C.xsl)

<xsl:stylesheet>
<xsl:include href="A.xsl" />
<xsl:include href="B.xsl" />
</xsl:stylesheet>

and test A.xsl by specifying C.xsl in /x:description/@stylesheet:

<x:description stylesheet="C.xsl">
...Scenarios for testing functions/templates in A.xsl...
</x:description>


Alternatively, on XSpec v2.0 or later, you can utilize x:helper instead
of writing C.xsl:

<x:description stylesheet="A.xsl">
<x:helper stylesheet="B.xsl" />
...Scenarios for testing functions/templates in A.xsl...
</x:description>


Hope it helps,
AirQuick

Reply all
Reply to author
Forward
0 new messages