org.apache.commons.jelly.tags.xml
Class ForEachTag

java.lang.Object
  extended byorg.apache.commons.jelly.TagSupport
      extended byorg.apache.commons.jelly.xpath.XPathTagSupport
          extended byorg.apache.commons.jelly.tags.xml.ForEachTag
All Implemented Interfaces:
org.apache.commons.jelly.Tag, org.apache.commons.jelly.xpath.XPathSource

public class ForEachTag
extends org.apache.commons.jelly.xpath.XPathTagSupport
implements org.apache.commons.jelly.xpath.XPathSource

A tag which performs an iteration over the results of an XPath expression

Version:
$Revision: 1.3 $
Author:
James Strachan

Field Summary
private  java.lang.Object iterationValue
          The current iteration value
private  org.jaxen.XPath select
          Holds the XPath selector.
private  java.lang.String var
          If specified then the current item iterated through will be defined as the given variable name.
private  org.apache.commons.jelly.xpath.XPathComparator xpCmp
          Xpath comparator for sorting
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
ForEachTag()
           
 
Method Summary
 void doTag(org.apache.commons.jelly.XMLOutput output)
           
protected  java.lang.Object getXPathContext()
           
 java.lang.Object getXPathSource()
           
 void setDescending(boolean descending)
          Set whether to sort ascending or descending.
 void setSelect(org.jaxen.XPath select)
          Sets the XPath selection expression
 void setSort(org.jaxen.XPath sortXPath)
          Sets the xpath expression to use to sort selected nodes.
 void setVar(java.lang.String var)
          Sets the variable name to export for the item being iterated over
 
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isTrim, setBody, setContext, setParent, setTrim, trimBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

select

private org.jaxen.XPath select
Holds the XPath selector.


xpCmp

private org.apache.commons.jelly.xpath.XPathComparator xpCmp
Xpath comparator for sorting


var

private java.lang.String var
If specified then the current item iterated through will be defined as the given variable name.


iterationValue

private java.lang.Object iterationValue
The current iteration value

Constructor Detail

ForEachTag

public ForEachTag()
Method Detail

doTag

public void doTag(org.apache.commons.jelly.XMLOutput output)
           throws org.apache.commons.jelly.JellyTagException
Specified by:
doTag in interface org.apache.commons.jelly.Tag
Throws:
org.apache.commons.jelly.JellyTagException

getXPathSource

public java.lang.Object getXPathSource()
Specified by:
getXPathSource in interface org.apache.commons.jelly.xpath.XPathSource
Returns:
the current XPath iteration value so that any other XPath aware child tags to use

setSelect

public void setSelect(org.jaxen.XPath select)
Sets the XPath selection expression


setVar

public void setVar(java.lang.String var)
Sets the variable name to export for the item being iterated over


setSort

public void setSort(org.jaxen.XPath sortXPath)
             throws org.jaxen.JaxenException
Sets the xpath expression to use to sort selected nodes.

Throws:
org.jaxen.JaxenException

setDescending

public void setDescending(boolean descending)
Set whether to sort ascending or descending.


getXPathContext

protected java.lang.Object getXPathContext()