Permalink
Browse files

Add example of dropping empty elements

  • Loading branch information...
1 parent 5e58260 commit 94ddff7117d25d3a8a89457eeb272b5500ec21c5 @lrowe lrowe committed Jan 31, 2012
@@ -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>
@@ -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>
@@ -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>
@@ -0,0 +1,3 @@
+<div id="target">
+ <div>Content</div>
+</div>

0 comments on commit 94ddff7

Please sign in to comment.