Package org.apache.xalan.xslt

Examples of org.apache.xalan.xslt.XSLTInputSource


    public void setStylesheet(String fileName) throws Exception {
        xslSheet = new XSLTInputSource (normalize(fileName));
    };

    public void transform(String infile, String outfile) throws Exception {
        processor.process(new XSLTInputSource(normalize(infile)), xslSheet,
                        new XSLTResultTarget(outfile));
    }
View Full Code Here


    // firstResult now functions as a SAX DocumentHandler.

    // The first transform (uses foo.xsl to transform foo.xml) produces a sequence of SAX
    // events (firstResult) that are in turn processed by the processor DocumentHandler
    // (using foo2.xsl), sending the ouput of the second transform to System.out.
    stylesheet.process(new XSLTInputSource("foo.xml"),
                       firstResult);
  }
View Full Code Here

  {
    // Create an XSLT processor.
    XSLTProcessor processor = XSLTProcessorFactory.getProcessor();

    // Create input source documents.
    XSLTInputSource xmlID = new XSLTInputSource("foo.xml");
    XSLTInputSource stylesheetID = new XSLTInputSource("foo.xsl");

    // Create a DOM Document node to attach the result nodes to.
    Document out = new org.apache.xerces.dom.DocumentImpl();
    XSLTResultTarget resultTarget = new XSLTResultTarget(out);
View Full Code Here

    processor.setStylesheetParam("param1", processor.createXString(args[0]));

    System.out.println("------------------");
    // Have the XSLTProcessor processor object transform "foo.xml" to
    // System.out, using the XSLT instructions found in "foo.xsl".
    processor.process(new XSLTInputSource("foo.xml"),
                      new XSLTInputSource("foo.xsl"),
                      new XSLTResultTarget(System.out));
    System.out.println("\n------------------");
  }
View Full Code Here

      time = System.currentTimeMillis();

    // Listener to be used for all reporting
    ApplyXSLListener listener = new ApplyXSLListener();

    XSLTInputSource xmlSource = null, xslSource = null;
    // creating XML XSLTInputSource
    try
    {
      if ((xmlSource = getDocument(processor, request, listener)) == null)
        throw new ApplyXSLException("getDocument() returned null",
View Full Code Here

    }
    parser.parse(new InputSource(ins));
    return new XSLTInputSource(parser.getDocument());
    */

    XSLTInputSource source = new XSLTInputSource(ins);

    // Not sure what to do about the catalog business here.  If this is needed,
    // we should have the liaison do it, if possible.

    return source;
View Full Code Here

        else
          // Configuration Default
          if ((xslURL = ourDefaultParameters.getXSLurl(null)) != null)
            listener.out.println("Parsing XSL Stylesheet Document from configuration: " + xslURL);
      }
      return new XSLTInputSource(toAcceptLanguageConnection(new URL(xslURL),
                                                            request).getURL().toString());
    }
    catch (IOException ioe)
    {
      throw new ApplyXSLException(ioe, HttpServletResponse.SC_NOT_FOUND);
View Full Code Here

    // new XSLTProcessor object.
    XSLTProcessor processor = XSLTProcessorFactory.getProcessor();

    // Have the XSLTProcessor processor object transform "foo.xml" to
    // System.out, using the XSLT instructions found in "foo.xsl".
    processor.process(new XSLTInputSource("foo.xml"),
                      new XSLTInputSource("foo.xsl"),
                      new XSLTResultTarget(System.out));
  }
View Full Code Here

     * @exception JspException if a JSP exception occurs
     */
    public int doEndTag() throws JspException {

  // 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());
View Full Code Here

    throw new JspException("Cannot find servlet context");
      InputStream stream =
    context.getResourceAsStream(resource);
      if (stream == null)
    throw new JspException("Missing resource '" + resource + "'");
      return new XSLTInputSource(stream);
  }

  // Locate the source object
  Object source = null;
  Object bean = pageContext.findAttribute(name);
  if (bean == null)
      throw new JspException("Missing bean '" + name + "'");
  if (property == null)
      source = bean;
  else {
      try {
    char first = Character.toUpperCase(property.charAt(0));
    String methodName = "get" + first + property.substring(1);
    Class paramTypes[] = new Class[0];
    Method method =
        bean.getClass().getMethod(methodName, paramTypes);
    source = method.invoke(bean, new Object[0]);
      } catch (Exception e) {
    throw new JspException(e.toString());
      }
  }


  // Create an XSLTInputSource for the specified source object
  if (source instanceof XSLTInputSource)
      return ((XSLTInputSource) source);
  else if (source instanceof String)
      return (new XSLTInputSource(new StringReader((String) source)));
  else if (source instanceof InputSource)
      return (new XSLTInputSource((InputSource) source));
  else if (source instanceof InputStream)
      return (new XSLTInputSource((InputStream) source));
  else if (source instanceof Node)
      return (new XSLTInputSource((Node) source));
  else if (source instanceof Reader)
      return (new XSLTInputSource((Reader) source));
  else
      throw new JspException("Invalid input source type '" +
           source.getClass().getName() + "'");

    }
View Full Code Here

TOP

Related Classes of org.apache.xalan.xslt.XSLTInputSource

Copyright © 2018 www.massapicom. 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.