Append Attributes (add classes, etc.)
This is an open discussion with 2 replies, filed under General.
Search
Sorry for the Markdown disaster. 4 spaces weren't enough (?). Fixed.
If a list item is followed by code, Markdown assumes that you want paragraphs in your list item. You would use the same indenting syntax for this:
* Sometimes this feature is welcome. Because your list item tells a longer story.
Sometimes this feature is welcome.
Because your list item tells a longer story.
Create an account or sign in to comment.
Ended up putting this together yesterday. It works pretty well in case anyone might need it.
Not putting into the XSLT Utilities yes, as it's still fairly untested.
Comments/suggestions hugely appreciated.
Overview
You have an element in the HTML you are parsing for which you would like to update some attributes. This helper does that. To use it match your element like this:
Do you stuff, set your conditions on which you'd like to change attributes etc., then continue like this:
The result will be a replaced element, with the new attribute's values merged with the existing ones. So if you create a new class="" attribute, it will be added without replacing the already existing ones.
Params
element: lets you change the element name. Cherry on top.