Extend client-side-templates to handle XSLT transformations #1210
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR extends client-side-templates with XSLT support.
Uses browser built-in XSLTProcessor, so no external dependencies are needed.
Since this is only a fourth supported templating engine, I don't think it adds any complexity.
Please let me know if I can improve this in any way!
A couple of other things, which I didn't include:
I don't know how external script support for the other engines is supposed to work, but at least for XSLT it seemed to work using an object tag (see https://lahteenmaki.net/davtest/ for an example). However, I didn't include anything about it in the documentation since I guess the handling should somehow be unified across all supported engines, or what do you think?
I noticed that the HTML template tag is often not useful for templates (dah...) since the browser seems to enforce HTML validity inside the tag. But templates often contain invalid HTML, for example when looping over rows inside a table, which the browser doesn't seem to accept. Therefore I used the script tag in the example. Maybe this problem should be somehow mentioned in the extension documentation, or what do you think?