cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [WIKI-UPDATE] XPatchTaskUsage Wed Jun 4 05:00:02 2003
Date Wed, 04 Jun 2003 03:00:03 GMT
Page: , version: 2 on Wed Jun  4 02:59:47
2003 by GeoffHoward

- Basics
- {{{<xpatch file="${build.webapp}/welcome.xml"
-             srcdir="${documentation}" 
+ !Xpatch element
+ {{{<xpatch file="path/to/file.xml"
+             srcdir="base/path" 
-             includes="**/*.xwelcome"/> }}}
?                            ^^^^ ^^

+             includes="**/*.patchtype"/> }}}
?                            ^^^ ^^^^

+ ||Attribute||Description||
+ |file|The file to modify|
+ |srcdir (optional)|The base path to resolve the target file and includes. Defaults to "."|
+ |includes|Files matching this pattern will be processed by the task|
+ ;;Because this task extends {{org.apache.ant.MatchingTask}}, other attributes and nested
tags are recognized.  See the Ant documentation for the full list of possibilities.
+ !Patch Files
+ For starters, the patch files recognized by {{xpatch}} follow the following basic rules:
+ * The root element name must match the patch file extension, or the file will be skipped.
+ * As the task expects the patch file to be well-formed xml, only one patch element may exist
per file.
+ * All child nodes of the root element of the patch file will be copied to the specified
location in the target file - including text and whitespace nodes.
+ ''Example'' (enable-uploads.xweb)
+ {{{<xweb xpath="/web-app/servlet/init-param[param-name='enable-uploads']/param-value"
+ 	if-prop="config.enable-uploads"
+ 	remove="/web-app/servlet/init-param[param-name='enable-uploads']/param-value/text()"
+ >true</xweb>}}}
+ ;;Note the sensitivity to whitespace necessary in this case.
+ ||Attribute||Description||
+ |xpath|An xpath expression that specifies the context node for the patch insertion.  __This
must return exactly one node.__|
+ |unless|(optional) An xpath expression which if present in the target document will supress
this patch.  This is often necessary to avoid multiple insertions when subsequent builds do
not also reset the target document. |
+ |unless-path|(optional) A proposed alternate name for {{unless}} that may make its definition
+ |if-prop|(optional) The name of a build property which must evaluate to {{true}} ({Boolean.valueOf()})
or this patch file will be skipped.|
+ |remove|(optional) An xpath expression of node(s) to remove before inserting this patch.
 Can be an alternative method for avoiding multiple insertions.  __This expression can return
a node-set of more than one node.  All matching nodes will be removed__|
+ |insert-before|(optional) An xpath expression that specifies where in the document the patch
will be placed.  If neither this nor {{insert-after}} are specified, the node will be the
last child node of the context specified in the {{xpath}} attribute.|
+ |insert-after|(optional) As above.  Ignored if {{insert-before}} is specified.|

View raw message