<strain> modify HTML with CSS selectors

xml namespace

Manipulate HTML with CSS selectors.

The select attribute should be a CSS selector which will filter tags from the src string. The other attributes define what should happen to the matches tags.

The following example defines a <filter> which uses <strain> to add class="lead" to the first paragraph of HTML:

<filter name="leadp" value="html">
    <doc>Add class="lead" to first paragraph</doc>
    <soup:strain src="html" select="p" max="1" let:class="'lead'" dst="leadp"/>
    <return value="html:leadp"/>
name purpose type required? default choices
append markup to append expression No None
filter Filter by attributes function No
max Maximum number of tags to match integer No
prepend markup to prepend expression No None
remove Remove matched element? boolean No
replace markup to replace expression No None
select CSS selector text No "*"
src HTML document or fragment expression Yes
inherited attributes
name purpose type required? default choices
dst Destination reference No
if Conditional expression expression No yes
value Value expression No None