Package com.icl.saxon.expr
Class FragmentValue
- java.lang.Object
-
- com.icl.saxon.expr.Expression
-
- com.icl.saxon.expr.Value
-
- com.icl.saxon.expr.NodeSetValue
-
- com.icl.saxon.expr.SingletonNodeSet
-
- com.icl.saxon.expr.FragmentValue
-
- All Implemented Interfaces:
org.w3c.dom.NodeList
public final class FragmentValue extends SingletonNodeSet
This class represents a Value of type result tree fragment.
A Result Tree Fragment can be created by defining a variable in XSL whose value is defined by the contents of the xsl:variable element, possibly including start and end element tags.
-
-
Field Summary
-
Fields inherited from class com.icl.saxon.expr.SingletonNodeSet
generalUseAllowed, node
-
Fields inherited from class com.icl.saxon.expr.Expression
staticContext
-
-
Constructor Summary
Constructors Constructor Description FragmentValue(Controller c)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanasBoolean()Convert the result tree fragment to a booleandoubleasNumber()Convert the result tree fragment to a numberjava.lang.StringasString()Convert the result tree fragment to a string.booleancompare(int operator, Value other)Test how a FragmentValue compares to another Value under a relational comparison.voidcopy(Outputter out)Copy the result tree fragment value to a given Outputtervoiddisplay(int level)Diagnostic print of expression structureNodeEnumerationenumerate()Return an enumeration of this nodeset value.booleanequals(Value other)Test whether a nodeset "equals" another ValueintgetCount()Count the nodes in the node-set.intgetDataType()Determine the data type of the expression, if possibleEmittergetEmitter()Get an Emitter that can be used to feed data to this result tree fragmentNodeInfogetFirst()Get the first node in the nodeset (in document order)DocumentInfogetRootNode()Get the root (document) nodeintgetType()Return the type of the valuebooleannotEquals(Value other)Test whether a nodeset "not-equals" another ValuevoidoutputStringValue(Outputter out, Context context)Evaluate an expression as a String and write the result to the specified outputter.voidreplay(Emitter emitter)Replay the saved emitter events to a new emittervoidsetBaseURI(java.lang.String uri)Set the Base URI for the nodes in the result tree fragment.Expressionsimplify()Simplify the expression-
Methods inherited from class com.icl.saxon.expr.SingletonNodeSet
allowGeneralUse, evaluate, evaluateAsNodeSet, getLength, isGeneralUseAllowed, isSorted, item, setSorted, sort
-
Methods inherited from class com.icl.saxon.expr.NodeSetValue
conversionPreference, convertToJava, enumerate
-
Methods inherited from class com.icl.saxon.expr.Value
getDependencies, inverse, numericCompare, reduce, stringToNumber
-
Methods inherited from class com.icl.saxon.expr.Expression
containsReferences, evaluateAsBoolean, evaluateAsNumber, evaluateAsString, getStaticContext, indent, isContextDocumentNodeSet, make, setStaticContext, usesCurrent
-
-
-
-
Constructor Detail
-
FragmentValue
public FragmentValue(Controller c)
-
-
Method Detail
-
setBaseURI
public void setBaseURI(java.lang.String uri)
Set the Base URI for the nodes in the result tree fragment. This is defined to be the Base URI of the relevant xsl:variable element in the stylesheet.
-
getEmitter
public Emitter getEmitter()
Get an Emitter that can be used to feed data to this result tree fragment
-
asString
public java.lang.String asString()
Convert the result tree fragment to a string.- Overrides:
asStringin classSingletonNodeSet- Returns:
- the value of the first node in the node-set if there is one, otherwise an empty string
-
outputStringValue
public void outputStringValue(Outputter out, Context context) throws javax.xml.transform.TransformerException
Evaluate an expression as a String and write the result to the specified outputter.- Overrides:
outputStringValuein classExpression- Parameters:
out- The required outputtercontext- The context in which the expression is to be evaluated- Throws:
javax.xml.transform.TransformerException
-
asNumber
public double asNumber()
Convert the result tree fragment to a number- Overrides:
asNumberin classNodeSetValue- Returns:
- the number obtained by evaluating as a String and converting the string to a number
-
asBoolean
public boolean asBoolean()
Convert the result tree fragment to a boolean- Overrides:
asBooleanin classSingletonNodeSet- Returns:
- true if the node set is not empty
-
getCount
public int getCount()
Count the nodes in the node-set.- Overrides:
getCountin classSingletonNodeSet
-
simplify
public Expression simplify()
Simplify the expression- Overrides:
simplifyin classSingletonNodeSet- Returns:
- the simplified expression
-
getFirst
public NodeInfo getFirst()
Get the first node in the nodeset (in document order)- Overrides:
getFirstin classSingletonNodeSet- Returns:
- the first node
-
enumerate
public NodeEnumeration enumerate() throws XPathException
Return an enumeration of this nodeset value.- Overrides:
enumeratein classSingletonNodeSet- Throws:
XPathException
-
equals
public boolean equals(Value other) throws XPathException
Test whether a nodeset "equals" another Value- Overrides:
equalsin classSingletonNodeSet- Returns:
- a boolean giving the value of the expression, evaluated in the current context
- Throws:
XPathException
-
notEquals
public boolean notEquals(Value other) throws XPathException
Test whether a nodeset "not-equals" another Value- Overrides:
notEqualsin classSingletonNodeSet- Returns:
- a boolean giving the value of the expression, evaluated in the current context
- Throws:
XPathException
-
compare
public boolean compare(int operator, Value other) throws XPathExceptionTest how a FragmentValue compares to another Value under a relational comparison.- Overrides:
comparein classNodeSetValue- Parameters:
operator- The comparison operator, one of Tokenizer.LE, Tokenizer.LT, Tokenizer.GE, Tokenizer.GT,- Throws:
XPathException
-
getType
public int getType()
Return the type of the value- Returns:
- Value.NODESET (always)
-
getDataType
public int getDataType()
Determine the data type of the expression, if possible- Overrides:
getDataTypein classNodeSetValue- Returns:
- Value.NODESET
-
getRootNode
public DocumentInfo getRootNode()
Get the root (document) node
-
copy
public void copy(Outputter out) throws javax.xml.transform.TransformerException
Copy the result tree fragment value to a given Outputter- Throws:
javax.xml.transform.TransformerException
-
replay
public void replay(Emitter emitter) throws javax.xml.transform.TransformerException
Replay the saved emitter events to a new emitter- Throws:
javax.xml.transform.TransformerException
-
display
public void display(int level)
Diagnostic print of expression structure- Overrides:
displayin classNodeSetValue
-
-