org.apache.taglibs.xtags.xslt
Class StyleTag

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended byjavax.servlet.jsp.tagext.BodyTagSupport
          extended byorg.apache.taglibs.xtags.xslt.StyleTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, ParameterAcceptingTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class StyleTag
extends javax.servlet.jsp.tagext.BodyTagSupport
implements ParameterAcceptingTag

A tag which performs an XSLT transformation on a given XML document

Author:
James Strachan
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
StyleTag()
           
 
Method Summary
protected  void configure(javax.xml.transform.Transformer transformer)
          Configures the Transformer before use
protected  javax.xml.transform.URIResolver createURIResolver()
          Creates a URI resolver capable of resolving URIs when used in XSLT includes or imports
 int doAfterBody()
          Extract the body if required for either the XML or XSLT
 int doEndTag()
          Perform the transformation and render the output.
 int doStartTag()
          Evaluate the body content of this tag if we need to for either the XML or XSLT data; otherwise we skip it.
protected  javax.xml.transform.Result getResult()
          Construct and return a JAXP Result
protected  javax.xml.transform.Source getSource(java.lang.Object source)
          Construct and return a JAXP Source to read the XML data to be styled.
protected  void handleException(java.lang.Exception e)
          Handles non-JspExceptions thrown in this instance
 void release()
          Release any allocated resources.
 void setDocument(org.dom4j.Document document)
          Sets the dom4j document to be styled
 void setOutputMethod(java.lang.String outputMethod)
           
 void setParameter(java.lang.String name, java.lang.Object value)
          Sets the given parameter name and value
 void setResult(javax.xml.transform.Result result)
          Sets the JAXP Result instance to
 void setResultHandler(org.xml.sax.ContentHandler handler)
          Sets the SAX ContentHandler that the output is written to
 void setTransformer(javax.xml.transform.Transformer transformer)
          Sets the XSLT transformer used to transform the document
 void setWriter(java.io.Writer writer)
          Sets where the output is written to
 void setXml(java.lang.String xml)
          Sets the XML URL that the input document is read from
 void setXmlReader(java.io.Reader reader)
           
 void setXmlSource(javax.xml.transform.Source source)
          Sets the source of the XML document
 void setXsl(java.lang.String xsl)
          Sets the XSL URL that the stylesheet is read from
 void setXslReader(java.io.Reader reader)
           
 void setXslSource(javax.xml.transform.Source source)
          Sets the source of the XML document
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Constructor Detail

StyleTag

public StyleTag()
Method Detail

setParameter

public void setParameter(java.lang.String name,
                         java.lang.Object value)
Description copied from interface: ParameterAcceptingTag
Sets the given parameter name and value

Specified by:
setParameter in interface ParameterAcceptingTag

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Evaluate the body content of this tag if we need to for either the XML or XSLT data; otherwise we skip it.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Throws:
javax.servlet.jsp.JspException - if a JSP error occurs

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspException
Extract the body if required for either the XML or XSLT

Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Throws:
javax.servlet.jsp.JspException - if a JSP error has occurred

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Perform the transformation and render the output.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Throws:
javax.servlet.jsp.JspException - if a JSP exception occurs

release

public void release()
Release any allocated resources.

Specified by:
release in interface javax.servlet.jsp.tagext.Tag

setOutputMethod

public void setOutputMethod(java.lang.String outputMethod)

setDocument

public void setDocument(org.dom4j.Document document)
Sets the dom4j document to be styled


setTransformer

public void setTransformer(javax.xml.transform.Transformer transformer)
Sets the XSLT transformer used to transform the document


setResult

public void setResult(javax.xml.transform.Result result)
Sets the JAXP Result instance to


setWriter

public void setWriter(java.io.Writer writer)
Sets where the output is written to


setResultHandler

public void setResultHandler(org.xml.sax.ContentHandler handler)
Sets the SAX ContentHandler that the output is written to


setXml

public void setXml(java.lang.String xml)
Sets the XML URL that the input document is read from


setXmlSource

public void setXmlSource(javax.xml.transform.Source source)
Sets the source of the XML document


setXmlReader

public void setXmlReader(java.io.Reader reader)

setXsl

public void setXsl(java.lang.String xsl)
Sets the XSL URL that the stylesheet is read from


setXslReader

public void setXslReader(java.io.Reader reader)

setXslSource

public void setXslSource(javax.xml.transform.Source source)
Sets the source of the XML document


configure

protected void configure(javax.xml.transform.Transformer transformer)
Configures the Transformer before use


getSource

protected javax.xml.transform.Source getSource(java.lang.Object source)
                                        throws javax.servlet.jsp.JspException
Construct and return a JAXP Source to read the XML data to be styled.

Parameters:
source - is the object to be converted into a JAXP Source
Throws:
javax.servlet.jsp.JspException - if a JSP error occurs

getResult

protected javax.xml.transform.Result getResult()
                                        throws javax.servlet.jsp.JspException
Construct and return a JAXP Result

Throws:
javax.servlet.jsp.JspException - if a JSP error occurs

createURIResolver

protected javax.xml.transform.URIResolver createURIResolver()
Creates a URI resolver capable of resolving URIs when used in XSLT includes or imports


handleException

protected void handleException(java.lang.Exception e)
                        throws javax.servlet.jsp.JspException
Handles non-JspExceptions thrown in this instance

Throws:
javax.servlet.jsp.JspException


Copyright ? 2000-2004 The Apache Software Foundation. All Rights Reserved.