I have three working xsl files, now I simply want to make them work together.
Suppose my three xslt are cham1.xsl, cham2.xsl, cham3.xsl and my source input source.xml. In the top table node of the input, there is an attribute outputclass:
<root outputclass="cham1">
What I want is how could I write another stylesheet, that whenever, the @outputclass is cham1, then call cham1.xsl, if @outputclass='cham2', then apply cham2.xsl on the source.
Wonder if this is feasible in xslt? Thanks!
There are basically two approaches: doing this within XSLT (in a single transformation), or doing it externally.
To do it within XSLT, the best way would be to ensure that the template rules in cham1.xsl, cham2.xsl, and cham3.xsl use different modes. The controlling code then simply needs to do apply-templates in the appropriate mode.
Doing it outside XSLT rather depends on your application environment, e.g. whether you are controlling things from Java, from Ant, from XProc, or etc.