ASF Bugzilla – Attachment 3885 Details for
Bug 14664
Patch update to ApplyTag, support Xalan 2.4.1.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to ApplyTag class.
applytag.txt (text/plain), 5.06 KB, created by
Juan F. Arjona
on 2002-11-19 01:29:06 UTC
(
hide
)
Description:
Patch to ApplyTag class.
Filename:
MIME Type:
Creator:
Juan F. Arjona
Created:
2002-11-19 01:29:06 UTC
Size:
5.06 KB
patch
obsolete
>Index: ApplyTag.java >=================================================================== >RCS file: /home/cvspublic/jakarta-taglibs/xsl/src/org/apache/taglibs/xsl/ApplyTag.java,v >retrieving revision 1.1 >diff -d -r1.1 ApplyTag.java >71,74c71,85 >< import org.apache.xalan.xslt.XSLTInputSource; >< import org.apache.xalan.xslt.XSLTProcessor; >< import org.apache.xalan.xslt.XSLTProcessorFactory; >< import org.apache.xalan.xslt.XSLTResultTarget; >--- >> import javax.xml.transform.stream.StreamSource; >> import javax.xml.transform.dom.DOMSource; >> import javax.xml.transform.sax.SAXSource; >> import javax.xml.transform.Transformer; >> import javax.xml.transform.TransformerFactory; >> import javax.xml.transform.Source; >> import javax.xml.transform.sax.SAXSource; >> import javax.xml.transform.sax.SAXResult; >> import javax.xml.transform.dom.DOMSource; >> import javax.xml.transform.dom.DOMResult; >> import javax.xml.transform.stream.StreamSource; >> import javax.xml.transform.stream.StreamResult; >> >> import javax.xml.transform.Result; >> >75a87,89 >> import org.w3c.dom.Document; >> import org.w3c.dom.Element; >> >77a92,93 >> import org.xml.sax.XMLReader; >> import org.xml.sax.helpers.XMLReaderFactory; >223c239 >< return (EVAL_BODY_TAG); >--- >> return (EVAL_BODY_INCLUDE); >253,266c269,280 >< // Prepare an input source for the data >< XSLTInputSource data = null; >< if (body != null) >< data = new XSLTInputSource(new StringReader(body)); >< else >< data = getInputSource(nameXml, propertyXml, xml); >< >< // Prepare an input source for the stylesheet >< XSLTInputSource style = >< getInputSource(nameXsl, propertyXsl, xsl); >< >< // Prepare an output source for the results >< XSLTResultTarget result = >< new XSLTResultTarget(pageContext.getOut()); >--- >> Source src = null; >> Source xslSrc = null; >> Result result = null; >> >> // Prepare an input source for the data >> if (body != null) { >> src = getSourceFromString(body); >> } else { >> src = getInputSource(nameXml, propertyXml, xml); >> }; >> xslSrc = getInputSource(nameXsl, propertyXsl, xsl); >> result = new javax.xml.transform.stream.StreamResult( pageContext.getOut() ); >268,275c282,290 >< // Create an XSLT processor and use it to perform the transformation >< XSLTProcessor processor = null; >< try { >< processor = XSLTProcessorFactory.getProcessor(); >< processor.process(data, style, result); >< } catch (SAXException e) { >< throw new JspException(e.toString()); >< } >--- >> // Create an XSLT transformer and use it to perform the transformation >> javax.xml.transform.Transformer transformer = null; >> try { >> TransformerFactory factory = TransformerFactory.newInstance(); >> transformer = factory.newTransformer( xslSrc ); >> transformer.transform( src, result ); >> } catch (javax.xml.transform.TransformerException e) { >> throw new JspException(e); >> }; >277d291 >< >307c321 >< private XSLTInputSource getInputSource(String name, String property, >--- >> private Source getInputSource(String name, String property, >321c335,336 >< return new XSLTInputSource(stream); >--- >> Source src = getSourceFromStream(stream); >> return src; >346,347c361,362 >< if (source instanceof XSLTInputSource) >< return ((XSLTInputSource) source); >--- >> if (source instanceof Source ) >> return ( (Source) source ); >349c364 >< return (new XSLTInputSource(new StringReader((String) source))); >--- >> return getSourceFromString( (String)source); >351c366 >< return (new XSLTInputSource((InputSource) source)); >--- >> return ( new SAXSource( (InputSource) source )) ; >353c368 >< return (new XSLTInputSource((InputStream) source)); >--- >> return ( getSourceFromStream( (InputStream) source ) ); >355,357c370,372 >< return (new XSLTInputSource((Node) source)); >< else if (source instanceof Reader) >< return (new XSLTInputSource((Reader) source)); >--- >> return ( getSourceFromDOM( (Node) source ) ); >> else if (source instanceof Reader) >> return ( getSourceFromReader( (Reader) source ) ); >363c378,401 >< >--- >> >> private Source getSourceFromStream(InputStream stream) { >> org.xml.sax.InputSource saxSrc = new org.xml.sax.InputSource(stream); >> Source src = new SAXSource( saxSrc ); >> return ( src ); >> } >> >> private Source getSourceFromReader(Reader rdr) { >> org.xml.sax.InputSource saxSrc = new org.xml.sax.InputSource(rdr); >> Source src = new SAXSource( saxSrc ); >> return ( src ); >> } >> >> private Source getSourceFromString(String theString) { >> org.xml.sax.InputSource saxSrc = new org.xml.sax.InputSource(new StringReader( theString )); >> Source src = new SAXSource( saxSrc ); >> return ( src ); >> } >> >> private Source getSourceFromDOM(Node node) { >> Source answ = null; >> answ = new javax.xml.transform.dom.DOMSource(node); >> return answ; >> }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 14664
: 3885