Combining XSLT transforms
- by Flynn1179
Is there a way to combine two XSLT documents into a single XSLT document that does the same as transforming using the original two in sequence?
i.e. Combining XSLTA and XSLTB into XSLTC such that XSLTB( XSLTA( xml )) == XSLTC( xml )?
There's three reasons I'd like to be able to do this:
Simplifies development; some operations need sequential transforms, and although I can generate a combined one by hand, it's a lot more difficult to maintain that two much simpler, separate transforms.
Speed; one transform is in most cases hopefully faster than two.
I'm currently working on a program that literally just transforms a data file in XML into an XHTML page capable of editing it using one XSLT, and a second XSLT that transforms the XHTML page back into the data file when it's saved. One test I hope to be able to do is to combine the two, and easily confirm that the 'combined' XSLT should leave the data unchanged.