|
From: Laurence R. <svn...@pl...> - 2012-01-31 17:26:05
|
Repository: diazo Branch: refs/heads/master Date: 2012-01-31T09:25:27-08:00 Author: Laurence Rowe (lrowe) <lau...@lr...> Commit: https://github.com/plone/diazo/commit/94ddff7117d25d3a8a89457eeb272b5500ec21c5 Add example of dropping empty elements Files changed: A lib/diazo/tests/drop-content-example-empty-tags/content.html A lib/diazo/tests/drop-content-example-empty-tags/output.html A lib/diazo/tests/drop-content-example-empty-tags/rules.xml A lib/diazo/tests/drop-content-example-empty-tags/theme.html diff --git a/lib/diazo/tests/drop-content-example-empty-tags/content.html b/lib/diazo/tests/drop-content-example-empty-tags/content.html new file mode 100644 index 0000000..da6b4af --- /dev/null +++ b/lib/diazo/tests/drop-content-example-empty-tags/content.html @@ -0,0 +1,6 @@ +<div id="content"> +<p></p> +<p> </p> +<p>Not empty paragraph text</p> +<p><span>Not empty paragraph element</span> +</div> diff --git a/lib/diazo/tests/drop-content-example-empty-tags/output.html b/lib/diazo/tests/drop-content-example-empty-tags/output.html new file mode 100644 index 0000000..5959e0d --- /dev/null +++ b/lib/diazo/tests/drop-content-example-empty-tags/output.html @@ -0,0 +1,11 @@ +<!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"> + <p>Not empty paragraph text</p> + <p> + <span>Not empty paragraph element</span> + </p> + </div> + </body> +</html> diff --git a/lib/diazo/tests/drop-content-example-empty-tags/rules.xml b/lib/diazo/tests/drop-content-example-empty-tags/rules.xml new file mode 100644 index 0000000..1726e47 --- /dev/null +++ b/lib/diazo/tests/drop-content-example-empty-tags/rules.xml @@ -0,0 +1,14 @@ +<?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"> + + <!-- indent and strip space for pretty output --> + <xsl:output indent="yes"/> + <xsl:strip-space elements="*"/> + + <drop content="p[not(*) and not(normalize-space())]"/> + + <replace css:theme="#target" css:content="#content" /> +</rules> \ No newline at end of file diff --git a/lib/diazo/tests/drop-content-example-empty-tags/theme.html b/lib/diazo/tests/drop-content-example-empty-tags/theme.html new file mode 100644 index 0000000..6fa48a6 --- /dev/null +++ b/lib/diazo/tests/drop-content-example-empty-tags/theme.html @@ -0,0 +1,3 @@ +<div id="target"> + <div>Content</div> +</div> |