How to combine many XSL files into one?

74 Views Asked by At

I have XSL files organized as tree structures with using inheritance with xsl:import directive. It's very convenient for development. But for backward compatibility, I need to produce a flat XSL file, packed in a JAR artefact. Does someone know a tool or library that can do flattening of XSL files (preferably in Java)?

1

There are 1 best solutions below

0
Michael Kay On

In general, it's not possible to flatten an XSLT stylesheet in this way. That's because a template rule in one module has higher precedence than a template rule in a module that it imports; if you want to move the two template rules into a single module then you need to assign explicit priorities to achieve the same effect; and even then it can't be reproduced exactly in all cases.

Of course there might be cases where it IS possible, if you don't use overrides in this way.