Combining XSLT transforms

Posted by Flynn1179 on Stack Overflow See other posts from Stack Overflow or by Flynn1179
Published on 2010-06-17T18:55:44Z Indexed on 2010/06/17 19:03 UTC
Read the original article Hit count: 164

Filed under:

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.

© Stack Overflow or respective owner

Related posts about xslt