|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.ejen.ext.GlobalVariables
Gobal variables utility (instanciable).
Usage (XSL stylesheet) |
---|
<?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ... xmlns:gvs="org.ejen.ext.GlobalVariables" extension-element-prefixes="gvs ..." exclude-result-prefixes="gvs ..." version="1.0"> <xsl:output method="xml" encoding="iso-8859-1"/> <xsl:template match="ejen"> <xls:variable name="vars1" select="gvs: |
Constructor Summary | |
GlobalVariables()
Constructs a new GlobalVariables object. |
|
GlobalVariables(GlobalVariables gvs)
Constructs a new GlobalVariables object with the same mappings as the given GlobalVariables. |
Method Summary | |
void |
clear(XSLProcessorContext context,
ElemExtensionCall elem)
Throws away all variables. |
NodeSet |
elements(ExpressionContext context)
Returns a NodeSet that contains all variable values in this GlobalVariables. |
XObject |
get(ExpressionContext context,
String name)
Gets the value of a variable. |
XObject |
get(XSLProcessorContext context,
ElemExtensionCall elem)
Gets the value of a variable. |
NodeSet |
keys(ExpressionContext context)
Returns a NodeSet that contains all variable names in this GlobalVariables. |
void |
put(XSLProcessorContext context,
ElemExtensionCall elem)
Creates (or updates the value of) a variable. |
void |
remove(XSLProcessorContext context,
ElemExtensionCall elem)
Removes a variable. |
int |
size(ExpressionContext context)
Returns variables count. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GlobalVariables()
<xsl:variable name="gvs1" select="gvs:new()"/> |
public GlobalVariables(GlobalVariables gvs)
<xsl:variable name="gvs2" select="gvs:new($gvs1)"/> |
gvs
- a GlobalVariables object to be copied in this GlobalVariables.Method Detail |
public void clear(XSLProcessorContext context, ElemExtensionCall elem)
<gvs:clear [instance="$gvs2"]/> |
context
- automatically passed by the xalan extension mechanism.elem
- automatically passed by the xalan extension mechanism.
WrappedRuntimeException
- if the instance attribute
is not an instance of GlobalVariables.public int size(ExpressionContext context)
<xsl:value-of select="gvs:size([$gvs2])"/> |
context
- automatically passed by the xalan extension mechanism.
GlobalVariables
.public void remove(XSLProcessorContext context, ElemExtensionCall elem)
<gvs:remove name="myVar"[ instance="$gvs2"]/> |
context
- automatically passed by the xalan extension mechanism.elem
- automatically passed by the xalan extension mechanism.
WrappedRuntimeException
- if the 'name' attribute is missing or if the instance attribute
is not an instance of GlobalVariables.public void put(XSLProcessorContext context, ElemExtensionCall elem)
<gvs:put name="myVar" [select="column[@primary-key='true']"] [instance="$gvs2"]/> or <gvs:put name="myVar" [attribute="Hello {people[$i]/@name} !"] [instance="$gvs2"]/> |
'select' and 'attribute' cannot be used at the same time. If none of those attributes is used, the default value "(no value)" is bound to the variable name.
context
- automatically passed by the xalan extension mechanism.elem
- automatically passed by the xalan extension mechanism.
WrappedRuntimeException
- with a XSL Exception
if the 'name' attribute.public XObject get(ExpressionContext context, String name)
<xsl:value-of select="gvs:get([$gvs2, ]'myVar')"/> |
context
- automatically passed by the xalan extension mechanism.name
- the name of the variable.
null
if there was
no such variable.public XObject get(XSLProcessorContext context, ElemExtensionCall elem)
<gvs:get name="myVar"[ instance="$gvs2"]/> |
context
- automatically passed by the xalan extension mechanism.elem
- automatically passed by the xalan extension mechanism.
null
if there was
no such variable.
WrappedRuntimeException
- with a XSL Exception
if the 'name' attribute is missing.public NodeSet elements(ExpressionContext context)
<xsl:for-each select="gvs:elements([$gvs2])"> ... </xsl:for-each> |
Returned NodeSet is rather an union of the values than a collection of the values: if the value of a variable is already a XNodeSet, returned NodeSet will contain all Nodes of this XNodeSet (and not a Node that contains the XNodeSet); same with XRTreeFrag values; if the value is a XString (or XBoolean, XNumber...), then returned NodeSet will contain a CDATA Node with a String representation of the value.
context
- automatically passed by the xalan extension mechanism.
WrappedRuntimeException
- DOM Exception...public NodeSet keys(ExpressionContext context)
<xsl:for-each select="gvs:keys([$gvs2])"> ... </xsl:for-each> |
Returned NodeSet is a collection of CDATA Nodes, each of them containing a variable name.
context
- automatically passed by the xalan extension mechanism.
WrappedRuntimeException
- DOM Exception...
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |