Open lo48576 opened 5 years ago
Do not forget that any XPath expressions in the stylesheet can bring in additional dependencies via the document function.
There will be no way to reliably find these via any kind of static analysis of the stylesheet.
Ah, I completely overlooked document()
function... Thank you for pointing out!
Updated the README.
I think such possibilities of unknown (non-static) dependencies can be detected statically (for example finding substring /document\s*(/
for all XPaths?), when false positives are allowed.
And when such possibilities are detected, the filter can fallback to the current mechanism (i.e. the filter should consider all XSLT templates are outdated).
I want
xsl
filter (layout) to track dependencies correctly, not to bealways_outdated
.I'm using XML to write my blog articles and convert them to XHTML with
xsl
layout which I customized. Recently I tried to implement XSLT dependency tracker to the filter, and it seemed to work as expected in my environment. The code is here: https://gist.github.com/lo48576/f331b8d164573006ec129e73514bd735.The core code is simple: use XPath to collect
@herf
s, open them, and do the same thing recursively.I won't make pull request for this, because I'm not good at Ruby and I don't understand nanoc's internals. However, I believe that nanoc can implement XSL filter to correctly track XSLT dependencies: this code is PoC.