Examples of XSLTProcessor


Examples of org.apache.excalibur.xml.xslt.XSLTProcessor

    /**
     * Stream out raw layout
     */
    public void toSAX(Layout layout, PortalService service, ContentHandler handler) throws SAXException {
        if (this.useStylesheet()) {
            XSLTProcessor processor = null;
            Source stylesheet = null;
            SourceResolver resolver = null;
            try {
                resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
                stylesheet = resolver.resolveURI(this.getStylesheetURI(layout));
                processor = (XSLTProcessor) this.manager.lookup(XSLTProcessor.ROLE);
                TransformerHandler transformer = processor.getTransformerHandler(stylesheet);
                SAXResult result = new SAXResult(new IncludeXMLConsumer((handler)));
                if (handler instanceof LexicalHandler) {
                    result.setLexicalHandler((LexicalHandler) handler);
                }
                transformer.setResult(result);
View Full Code Here

Examples of org.apache.excalibur.xml.xslt.XSLTProcessor

                        PortalService service,
                        ContentHandler handler)
    throws SAXException {
        PreparedConfiguration config = (PreparedConfiguration)context.getAspectConfiguration();

        XSLTProcessor processor = null;
        Source stylesheet = null;
        SourceResolver resolver = null;
        try {
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
            stylesheet = resolver.resolveURI(this.getStylesheetURI(config, layout));
            processor = (XSLTProcessor) this.manager.lookup(config.xsltRole);
            TransformerHandler transformer = processor.getTransformerHandler(stylesheet);
            SAXResult result = new SAXResult(new IncludeXMLConsumer((handler)));
            if (handler instanceof LexicalHandler) {
                result.setLexicalHandler((LexicalHandler) handler);
            }
            transformer.setResult(result);
View Full Code Here

Examples of org.apache.excalibur.xml.xslt.XSLTProcessor

    /**
     * Stream out raw layout
     */
    public void toSAX(Layout layout, PortalService service, ContentHandler handler) throws SAXException {
        if (this.useStylesheet()) {
            XSLTProcessor processor = null;
            Source stylesheet = null;
            SourceResolver resolver = null;
            try {
                resolver = (SourceResolver) this.componentManager.lookup(SourceResolver.ROLE);
                stylesheet = resolver.resolveURI(this.getStylesheetURI(layout));
                processor = (XSLTProcessor) this.componentManager.lookup(XSLTProcessorImpl.ROLE);
                TransformerHandler transformer = processor.getTransformerHandler(stylesheet);
                SAXResult result = new SAXResult(new IncludeXMLConsumer((handler)));
                if (handler instanceof LexicalHandler) {
                    result.setLexicalHandler((LexicalHandler) handler);
                }
                transformer.setResult(result);
View Full Code Here

Examples of org.apache.excalibur.xml.xslt.XSLTProcessor

     *
     * @return a <code>TransformerHandler</code> value
     */
    public TransformerHandler getTransformerHandler() throws ProcessingException
    {
        XSLTProcessor xsltProcessor = null;
        Source source = null;
        try {
            xsltProcessor = (XSLTProcessor)this.manager.lookup(XSLTProcessor.ROLE);
            source = this.resolver.resolveURI( this.systemId );

            // If the Source object is not changed, the
            // getTransformerHandler() of XSLTProcessor will simply return
            // the old template object. If the Source is unchanged, the
            // namespaces are not modified either.
            XMLFilter saveNSFilter = new SaveNamespaceFilter(namespaceURIs);
            return xsltProcessor.getTransformerHandler(source, saveNSFilter);

        } catch (ComponentException e) {
            throw new ProcessingException("Could not obtain XSLT processor", e);
        } catch (MalformedURLException e) {
            throw new ProcessingException("Could not resolve " + this.systemId, e);
View Full Code Here

Examples of org.apache.excalibur.xml.xslt.XSLTProcessor

            throws IllegalArgumentException, ProcessingException {
        try {
            CharArrayWriter writer = new CharArrayWriter();
            StreamResult result = new StreamResult(writer);

            XSLTProcessor transformer
                    = (XSLTProcessor) componentManager.lookup(XSLTProcessor.ROLE);

            try {
                transformer.transform(this, stylesheet, params, result);
            } finally {
                componentManager.release(transformer);
            }

            return new XScriptObjectResult(xscriptManager, writer.toString());
View Full Code Here

Examples of org.apache.felix.mosgi.jmx.httpconnector.mx4j.tools.adaptor.http.XSLTProcessor

      http.setPort((new Integer(httpPort)).intValue());
      http.setHost("0.0.0.0"); //For external access
 
      processorName = new ObjectName("HtmlAdaptor:name=XSLTProcessor");
      XSLTProcessor processor=new XSLTProcessor();

      server.registerMBean(processor, processorName);
      server.registerMBean(http, httpName);

      http.setProcessorName(processorName);
View Full Code Here

Examples of org.apache.synapse.processors.builtin.xslt.XSLTProcessor


    public void testXSLTProcessor() throws Exception {
        SynapseMessage sm = new Axis2SynapseMessage(
                Axis2EnvSetup.axis2Deployment("target/synapse-repository"));
        XSLTProcessor pro = new XSLTProcessor();
        pro.setXSLInputStream(new ByteArrayInputStream(xsl.getBytes()));
        pro.setIsBody(true);
        boolean result = pro.process(null, sm);
        assertTrue(result);
    }
View Full Code Here

Examples of org.apache.xalan.xslt.XSLTProcessor

     XSLTInputSource XSLinput = new XSLTInputSource (readerInput);

  StringWriter outBuffer = new StringWriter();
  XSLTResultTarget XSLoutput = new XSLTResultTarget(outBuffer)
try {
  XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
  processor.process(XSLinput, new XSLTInputSource(templateName),
                          XSLoutput);
} catch (Exception e) {
  e.printStackTrace();
}
  String result = XSLoutput.getCharacterStream().toString();
View Full Code Here

Examples of org.apache.xalan.xslt.XSLTProcessor

  StringWriter outBuffer = new StringWriter();
  XSLTResultTarget XSLoutput = new XSLTResultTarget(outBuffer)
try {
  // Set up the XSLTProcessor to use XercesLiaison.
  XSLTProcessor processor = XSLTProcessorFactory.getProcessor
                                  (new org.apache.xalan.xpath.xdom.XercesLiaison());

  processor.process(XSLinput, new XSLTInputSource(templateName),
                          XSLoutput);
} catch (Exception e) {
  e.printStackTrace();
}
  String result = XSLoutput.getCharacterStream().toString();
View Full Code Here

Examples of org.apache.xalan.xslt.XSLTProcessor

  private String doXML(String newsURL) throws IOException {
     
  StringWriter wrt = new StringWriter();
                                                       
    try{
          XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
   
  
          processor.process(new XSLTInputSource(newsURL),
                            new XSLTInputSource("http://home.nordija.dk/news.xsl"),
                            new XSLTResultTarget(wrt));
  
   
         }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.