Is it possible to log/capture which XSL templates are used and/or not used during an XML transform using lxml
? I'm looking to report on and prune unused templates to reduce "technical debt".
Asked
Active
Viewed 40 times
0

mzjn
- 48,958
- 13
- 128
- 248

Phillip B Oldham
- 18,807
- 20
- 94
- 134
-
Use unittests and prune based on test failures? If the tests fail, the template was being used? – Martijn Pieters Mar 26 '13 at 14:05
1 Answers
0
lxml
's transform methods allow you to profile a transformation, and obtain the results as an XML document which shows how many times a pattern/mode/named-template was used. It should be possible to then perform an XPath across the XSL files to obtain all the comparative patterns/modes/named-templates and compare the two lists to see which templates are most/least used.

Phillip B Oldham
- 18,807
- 20
- 94
- 134