Package org.jdom.transform

Examples of org.jdom.transform.XSLTransformer


   */

  public void XmlTransformation(OutputStream out, Document doc, String filename) throws XSLTransformException, IOException {
    Document docTrans = new Document();
    if (filename != null && filename.equals("")) {
      XSLTransformer transformer;
      transformer = new XSLTransformer(filename);
      docTrans = transformer.transform(doc);
    } else {
      docTrans = doc;
    }
    Format format = Format.getPrettyFormat();
    format.setEncoding("utf-8");
View Full Code Here


  // Alternative approach to last funciton
  public final static Document simpleTransformer(String xsltFile,
      Document inputXML) {
    Document outputXML = null;

    XSLTransformer transformer;
    try {
      transformer = new XSLTransformer(xsltFile);
      outputXML = transformer.transform(inputXML);
    }
    catch(XSLTransformException e) {
      e.printStackTrace();
    }
    return outputXML;
View Full Code Here

            fileCleaningTracker.track(stream.getFile(), inputStream);
            if (stream.isInMemory()) {
                inputStream.close();
                inputStream = new ByteArrayInputStream(stream.getData());
            }
            XSLTransformer xslTransformer = new XSLTransformer(xsl);
            SAXBuilder saxBuilder = new SAXBuilder(false);
            Document document = saxBuilder.build(inputStream);
            Document document1 = xslTransformer.transform(document);
            XMLOutputter xmlOutputter = new XMLOutputter(Format.getPrettyFormat());
            xmlOutputter.output(document1, outputStream);
        }
    }
View Full Code Here

        in = XmlFormatter.class.getResourceAsStream(resource);
        if (in == null) {
            Logger.getLogger(XmlFormatter.class.getName()).log(Level.SEVERE, "Resource could not be loaded: " + resource);
            throw new XSLTransformException("Resource could not be loaded: " + resource);
        }
        XSLTransformer transformer = new XSLTransformer(in);
       
        Document foDoc = transformer.transform(sourceDoc);
        return foDoc;
    }
View Full Code Here

        in = XmlFormatter.class.getResourceAsStream(resource);
        if (in == null) {
            Logger.getLogger(XmlFormatter.class.getName()).log(Level.SEVERE, "Resource could not be loaded: " + resource);
            throw new XSLTransformException("Resource could not be loaded: " + resource);
        }
        XSLTransformer transformer = new XSLTransformer(in);
       
        Document foDoc = transformer.transform(sourceDoc);
        return foDoc;
    }
View Full Code Here

        init();

        if (dso.getType() != Constants.ITEM)
            throw new CrosswalkObjectNotSupported("XSLTDisseminationCrosswalk can only crosswalk an Item.");
        Item item = (Item)dso;
        XSLTransformer xform = getTransformer(DIRECTION);
        if (xform == null)
            throw new CrosswalkInternalException("Failed to initialize transformer, probably error loading stylesheet.");

        try
        {
            Document ddim = new Document(getDim(item));
            Document result = xform.transform(ddim);
            return result.getRootElement();
        }
        catch (XSLTransformException e)
        {
            log.error("Got error: "+e.toString());
View Full Code Here

        init();

        if (dso.getType() != Constants.ITEM)
            throw new CrosswalkObjectNotSupported("XSLTDisseminationCrosswalk can only crosswalk an Item.");
        Item item = (Item)dso;
        XSLTransformer xform = getTransformer(DIRECTION);
        if (xform == null)
            throw new CrosswalkInternalException("Failed to initialize transformer, probably error loading stylesheet.");

        try
        {
            return xform.transform(getDim(item).getChildren());
        }
        catch (XSLTransformException e)
        {
            log.error("Got error: "+e.toString());
            throw new CrosswalkInternalException("XSL translation failed: "+e.toString());
View Full Code Here

        {
            try
            {
                log.debug((transformer == null ? "Loading " : "Reloading")+
                          getPluginInstanceName()+" XSLT stylesheet from "+transformerFile.toString());
                transformer = new XSLTransformer(transformerFile);
                transformerLastModified = transformerFile.lastModified();
            }
            catch (XSLTransformException e)
            {
                log.error("Failed to initialize XSLTCrosswalk("+getPluginInstanceName()+"):"+e.toString());
View Full Code Here

    {
        if (dso.getType() != Constants.ITEM)
            throw new CrosswalkObjectNotSupported("XsltSubmissionionCrosswalk can only crosswalk to an Item.");
        Item item = (Item)dso;

        XSLTransformer xform = getTransformer(DIRECTION);
        if (xform == null)
            throw new CrosswalkInternalException("Failed to initialize transformer, probably error loading stylesheet.");
        try
        {
            List dimList = xform.transform(metadata);
            applyDim(dimList, item);
        }
        catch (XSLTransformException e)
        {
            log.error("Got error: "+e.toString());
View Full Code Here

    {
        if (dso.getType() != Constants.ITEM)
            throw new CrosswalkObjectNotSupported("XsltSubmissionionCrosswalk can only crosswalk to an Item.");
        Item item = (Item)dso;

        XSLTransformer xform = getTransformer(DIRECTION);
        if (xform == null)
            throw new CrosswalkInternalException("Failed to initialize transformer, probably error loading stylesheet.");
        try
        {
            Document dimDoc = xform.transform(new Document((Element)root.clone()));
            applyDim(dimDoc.getRootElement().getChildren(), item);
        }
        catch (XSLTransformException e)
        {
            log.error("Got error: "+e.toString());
View Full Code Here

TOP

Related Classes of org.jdom.transform.XSLTransformer

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.