org.mmbase.bridge.util.xml
Class NodeFunction

java.lang.Object
  extended by org.mmbase.bridge.util.xml.NodeFunction

public class NodeFunction
extends Object

Nodes of the bridge can have `virtual fields', which are in fact functions on the node. An example of such a function is "gui()". If you want to use these functions in an XSL transformation it is necessary to use this Xalan extension. The XSLT looks like this then:

  <xsl:stylesheet  version = "1.0"
    xmlns:xsl ="http://www.w3.org/1999/XSL/Transform"
    xmlns:node ="org.mmbase.bridge.util.xml.NodeFunction"
  >
  ..
  
You can then use a function like this if in the current template is a DOM Node with a 'field' subnode.
  ..
  <img src="{$formatter_imgdb}{node:function(., 'cache(s(180x180))')}" />
  
And otherwise you can also feed it a number:
  ..
  <img src="{$formatter_imgdb}{node:function(string(@number), 'cache(s(180x180))')}" />
  
Possibly even with the name of MMBase:
  ..
  <img src="{$formatter_imgdb}{node:function('mmbase', string(@number), 'cache(s(180x180))')}" />
  

Since:
MMBase-1.6
Version:
$Id: NodeFunction.java,v 1.22 2008/07/29 09:19:10 michiel Exp $
Author:
Michiel Meeuwissen

Constructor Summary
NodeFunction()
           
 
Method Summary
static String function(Cloud cloud, Node node, String function)
          It can be handy to supply a whole node, it will search for the field 'number' itself.
static String function(Cloud cloud, String number, String function)
          Note: Saxon cannnot distinguish this function from function(String, String, String), consider using saxonFunction(Object, String, String) in stead.
static String function(Cloud cloud, String number, String function, Object request)
           
static String function(Node node, String function)
          It can be handy to supply a whole node, it will search for the field 'number' itself.
static String function(String node, String function)
          Supposes the default cloud 'mmbase'.
static String function(String cloudName, String number, String function)
          Note: Saxon cannnot distinguish this function from function(Cloud, String, String), consider using saxonFunction(Object, String, String) in stead.
static String guiName(Cloud cloud, String node)
           
static Element nodeFunction(NodeList destination, Cloud cloud, String number, String function, String arguments)
           
static String saxonFunction(Object cloud, String number, String function)
          Saxon cannot distinguish the above two functions (function(String, String, String), function(Cloud, String, String)).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeFunction

public NodeFunction()
Method Detail

function

public static String function(String node,
                              String function)
Supposes the default cloud 'mmbase'.

Parameters:
node - The number (or alias) of the Node
function - The function (with arguments).
Returns:
The result of the function (as a String)
See Also:
function(String, String, String)

function

public static String function(String cloudName,
                              String number,
                              String function)
Note: Saxon cannnot distinguish this function from function(Cloud, String, String), consider using saxonFunction(Object, String, String) in stead.

Parameters:
cloudName - The name of the Cloud.
number - The number (or alias) of the Node
function - The function (with arguments).
Returns:
The result of the function (as a String)

function

public static String function(Cloud cloud,
                              String number,
                              String function)
Note: Saxon cannnot distinguish this function from function(String, String, String), consider using saxonFunction(Object, String, String) in stead.


saxonFunction

public static String saxonFunction(Object cloud,
                                   String number,
                                   String function)
Saxon cannot distinguish the above two functions (function(String, String, String), function(Cloud, String, String)). So, you can help it and use this one in stead.

Since:
MMBase-1.8.4

nodeFunction

public static Element nodeFunction(NodeList destination,
                                   Cloud cloud,
                                   String number,
                                   String function,
                                   String arguments)
Since:
MMBase-1.8

function

public static String function(Node node,
                              String function)
                       throws XPathExpressionException
It can be handy to supply a whole node, it will search for the field 'number' itself.

Parameters:
node - The number (or alias) of the Node
function - The function (with arguments).
Returns:
The result of the function (as a String)
Throws:
XPathExpressionException - if xpath fails

function

public static String function(Cloud cloud,
                              String number,
                              String function,
                              Object request)
Parameters:
request - Meant to be an HttpServletRequest. If not, will be ignored (empty string e.g.).
Since:
MMBase-1.8

function

public static String function(Cloud cloud,
                              Node node,
                              String function)
                       throws XPathExpressionException
It can be handy to supply a whole node, it will search for the field 'number' itself.

Parameters:
cloud - cloud to execute in
node - The number (or alias) of the Node
function - The function (with arguments).
Returns:
The result of the function (as a String)
Throws:
TransformerException - if xpath fails
XPathExpressionException

guiName

public static String guiName(Cloud cloud,
                             String node)
Since:
MMBase-1.8


MMBase build 1.9.0.20081107