You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by st...@outerthought.org on 2003/09/03 12:00:03 UTC
[WIKI-UPDATE] XPatchTaskUsage XMLFormsStruts Wed Sep 3 12:00:03 2003
Page: http://wiki.cocoondev.org/Wiki.jsp?page=XPatchTaskUsage , version: 8 on Wed Sep 3 09:23:42 2003 by StevenNoels
- |{{xpath}}|An xpath expression that specifies the context node for the patch insertion. __This must return exactly one node.__|
? ^
+ |{{xpath}}|An xpath expression that specifies the context node for the patch insertion. __This must return exactly one node __ and is required even when using {{insert-after}}.|
? ^ ++++++++++++++++++++++++++++++++++++++++++++++++++
- |{{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-before}}|(optional) An xpath expression that specifies where in the document the patch will be placed. by default, the expression is evaluated relative to the node specified by the {{xpath}} attribute. If neither this nor {{insert-after}} are specified, the node will be the last child node of the context specified in the {{xpath}} attribute.|
? +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ ----
+ !Example
+ Here's an example inserting the {{load-class}} directive ({{web.xml}}) for a database driver in case it doesn't exist already. There's a catch with the {{web.xml}} structure - you have to be rather precise where you insert another {{init-param}} element, since other elements can appear on the same level, and the order is important.
+
+ {{{<xweb unless="/web-app/servlet/init-param[contains(param-value,'org.gjt.mm.mysql.Driver')]"
+ xpath="/web-app/servlet"
+ insert-after="init-param[position()=last()]">
+ <init-param>
+ <param-name>load-class</param-name>
+ <param-value>
+ org.gjt.mm.mysql.Driver
+ </param-value>
+ </init-param>
+ </xweb>}}}
+
+ The {{unless}} attribute checks whether there exists an {{init-param}} already referring to the mysql jdbc driver class, the {{xpath}} attribute points to the context (root) node where the {{init-param}} will be inserted, and the {{insert-after}} contains another XPath expression selecting the last already existing {{init-param}}, after which the new one will be inserted. - [SN|StevenNoels]
+
Page: http://wiki.cocoondev.org/Wiki.jsp?page=XMLFormsStruts , version: 5 on Wed Sep 3 09:47:52 2003 by 193.190.59.97
- Is this possible ?
-