Permalink
Browse files

Document negated conditions.

  • Loading branch information...
1 parent aba0301 commit 0e8de53b2750a8d8f55d731a6245755a3a83e722 @lrowe lrowe committed Apr 20, 2012
Showing with 15 additions and 2 deletions.
  1. +15 −2 docs/advanced.rst
View
@@ -21,7 +21,7 @@ Conditions based on content nodes
in the content, the rule will be applied::
<replace css:theme-children="#portlets" css:content=".portlet"/>
- <drop css:theme="#portlet-wrapper" if-content="not(//*[@class='portlet'])"/>
+ <drop css:theme="#portlet-wrapper" css:if-content="#content.wide"/>
This will copy all elements with class ``portlet`` into the ``portlets``
element. If there are no matching elements in the content we drop the
@@ -63,6 +63,11 @@ final rule will be used as a fallback (since it has no ``if-content``),
taking the contents of the ``<title />`` tag in the head of the content
document.
+A content condition may be negated with ``if-not-content`` or ``css:if-not-content``,
+for example::
+
+ <drop css:theme="#portlet-wrapper" css:if-not-content=".portlet"/>
+
Conditions based on paths
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -107,6 +112,10 @@ attribute as whitespace separated list::
matches ``/`` and ``/index.html``. ``if-path="/"`` is considered an exact
match condition
+A path condition may be negated with ``if-not-path``, for example::
+
+ <drop css:theme="#info-box" if-not-path="/news"/>
+
Conditions based on arbitrary parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -116,7 +125,11 @@ valid XPath expression.
For example, if the transform is set up to receive a string parameter
``$mode``, you could write::
- <drop css:theme="test-site-warning" if="$mode = 'live'" />
+ <drop css:theme=".test-site-warning" if="$mode = 'live'" />
+
+Use the ``if-not`` attribute to negate the conditon, for example::
+
+ <drop css:theme=".test-site-warning" if-not="$mode = 'live'" />
Condition grouping and nesting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 comments on commit 0e8de53

Please sign in to comment.