Question

I need to maintain some old XSL code and I've discovered that there's a lot of duplication in the XSL files. It looks like there isn't an easy include/import function for XSL which would allow me to move the code to a different file and just include it when needed.

This sounds like it could be done with Model Driven Development tools but I've only heard about it, not actually used it and it is probably overkill for the job.

Is there a simple preprocessor that can be called from Ant which has include/import support?

Was it helpful?

Solution

There is an include mechanism for XSL. See http://www.w3.org/TR/xslt#section-Combining-Stylesheets for details.

If you can't achieve what you want with that, you can preprocess your XSL with another XSL transform: XSL is just XML. But... I don't think that the programmers who have to maintain your project after you've gone will thank you for doing that!

If you just want a cross-platform replacement for M4 you can invoke Velocity, Freemarker or another template library from Ant.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top