Modifying text

This recipe demonstrates the modification of some text.

Rules

<?xml version="1.0" encoding="UTF-8"?>
<rules xmlns="http://namespaces.plone.org/diazo"
       xmlns:css="http://namespaces.plone.org/diazo/css"
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <replace css:theme="#target" css:content="#content" />

    <xsl:template match="h2/text()"><xsl:copy /> - Some extra text</xsl:template>

</rules>

Theme

<div id="target">
    <div>Content</div>
</div>

Content

<div id="content">
    <h2>Some heading text</h2>
    Text
    <h2>Some more heading text</h2>
    Text
</div>

Output

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <body>
    <div id="content">
    <h2>Some heading text - Some extra text</h2>
    Text
    <h2>Some more heading text - Some extra text</h2>
    Text
</div>
  </body>
</html>