tags:

views:

55

answers:

2

I have several different XSLT files that all work on the same original XML file to produce four different XML file outputs. Is it possible to make all these XSLT files into one using vanilla XSLT (that is, not using XALAN or anything that's XSLT-parser specific)?

All help is appreciated and thanks in advance!

A: 

You could to use <xsl:import>

EDIT

No, this code will not generate four XML files, but merge several XSLT files to be processed as one. You can't achieve that without interacting with your XSLT processor, as XSLT itself doesn't care about files, just to translate a XML format into another.

Rubens Farias
Are you suggesting that I use <xsl:import> to import the four files that I currently have? Would that even work?
adam_0
I understood you have several XSLT files to merge, not XML files. Is that correct?
Rubens Farias
Yes, but the merged XSLT files must still produce 4 file outputs. Would this method do that?
adam_0
+2  A: 

It is possible to produce multiple files from a single XSLT, in an XSLT 2.0 styelsheet.

In XSLT 2.0 xsl:result-document can be used multiple times to produce multiple output files.

Depending on how the individual XSLT stylesheets are written, you may be able to import or include the stylesheets into a "parent" stylesheet that uses xsl:result-document to execute different named templates or apply-templates with different context and/or modes to output the different files.

Mads Hansen
In Microsoft Visual Studio 2008, whenever I create an xsl:result-document element under an xsl:template element, I get the highlighting under the xsl:result-document saying that it's an invalid child. Does VS not accept XSLT v. 2.0?
adam_0
I don't think so. Microsoft has yet to build support for XSLT 2.0. Saxon has a .NET implementation that can be used http://saxon.sourceforge.net/
Mads Hansen
I just started using xsl:result-document in a basic example in Saxon, I will try to implement it with my scripts and share my results.
adam_0
Works great! Thanks for the help!
adam_0