org.inria.ns.reflex.processor.xcl
Class ParseStylesheetAction

java.lang.Object
  extended by org.inria.ns.reflex.processor.core.AbstractAction
      extended by org.inria.ns.reflex.processor.core.AbstractSetAction
          extended by org.inria.ns.reflex.processor.xcl.ParseStylesheetAction
All Implemented Interfaces:
Computable, Executable, Presentable, NamespaceContextFactory

public class ParseStylesheetAction
extends AbstractSetAction

The <xcl:parse-stylesheet> element parses the XSLT stylesheet specified in the source attribute to a reusable Templates object.

<xcl:parse-stylesheet name="xslt" source="{$xsltFile}">
     <xcl:param name="http://xml.apache.org/xalan/features/incremental" value="true">
</xcl:parse-stylesheet/>

The system-id attribute may be used to set (as an expression) an identifier for this stylesheet.

XSLT sources

The XSLT source processed may be :

URI resolution

URIs are resolved with the catalog in use by the processor instance. See URIReferenceResolver.

Error handling

See XMLError.

Passing parameters to the XSLT processor

Parameters may be set conditionnally (subactions can be used), like this :

  <xcl:parse-stylesheet name="xslt" source="{$xsltFile}">
     <xcl:if test="{$incremental}">
         <xcl:then><!--set the parameter only if it exists-->
             <xcl:param name="http://xml.apache.org/xalan/features/incremental" value="{$incremental}">
         </xcl:then>
     </xcl:if>
  </xcl:parse-stylesheet/>
 

Notice that in the terminology, an XSLT processor is using attributes ; the parameters are used to set the attributes of the XSLT processor.

Notice that, when invoked (see <xcl:transform>), it is also possible to use <xcl:param> to send parameters to the stylesheet.

Author:
Philippe Poulard
See Also:
TransformAction

Nested Class Summary
 
Nested classes/interfaces inherited from class org.inria.ns.reflex.processor.core.AbstractAction
AbstractAction.ParameterAdapter, AbstractAction.UselessAction
 
Field Summary
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractSetAction
NO_VALUE
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractAction
actions, parent, processorInstance
 
Constructor Summary
ParseStylesheetAction(Expression source, Expression systemId, Element element, AbstractAction parent)
          Create a new instance of ParseStylesheetAction.
 
Method Summary
 Object getComputedValue(DataSet dataSet)
          Return the computed value of the property, by parsing an XSLT stylesheet.
static AbstractAction unmarshal(AbstractAction parent, Element e)
          XML unmarshaller for ParseStylesheetAction.
 
Methods inherited from class org.inria.ns.reflex.processor.core.AbstractSetAction
addProperty, getComputedName, getName, getValue, runAction, scope, unmarshalScope
 
Methods inherited from class org.inria.ns.reflex.processor.core.AbstractAction
addAction, addFallbackAction, createContext, getCanonicalPath, getFallbackAction, getLocalFallbackAction, getLogger, getNamespaceContext, getNode, getParent, recover, recover, removeFallbackAction, reorganize, run, runActions, toPrettyString, toPrettyString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParseStylesheetAction

public ParseStylesheetAction(Expression source,
                             Expression systemId,
                             Element element,
                             AbstractAction parent)
                      throws XMLException
Create a new instance of ParseStylesheetAction.

Parameters:
source - The source of XSLT stylesheet to parse, that will be the value of the property, as an Expression.
systemId - The system identifier for the stylesheet as an expression, or null.
element - The element from which the action has been unmarshalled. Used for namespace prefix resolution when performing XPath expressions.
parent - The action depending from.
Throws:
XMLException
Method Detail

unmarshal

public static AbstractAction unmarshal(AbstractAction parent,
                                       Element e)
                                throws XMLException
XML unmarshaller for ParseStylesheetAction.

Parameters:
parent - The action depending from
e - The XML element to unmarshall.
Returns:
The ParseStylesheetAction created.
Throws:
UnmarshalException - When the element and its content is not those expected.
XMLException

getComputedValue

public Object getComputedValue(DataSet dataSet)
                        throws ExecutionException,
                               XPathException
Return the computed value of the property, by parsing an XSLT stylesheet.

Specified by:
getComputedValue in interface Computable
Specified by:
getComputedValue in class AbstractSetAction
Parameters:
dataSet - The set of datas used when the name is computed.
Returns:
The computed value of the property.
Throws:
ExecutionException - If the computation can't be performed.
XPathException