Package nu.xom.xslt

Examples of nu.xom.xslt.XSLTransform.transform()


   * @throws IOException if there are problems reading or parsing the Schematron file
   */
  public List<ValidationMessage> validateWithSchematron(File schematronFile) throws XSLException, IOException {
    List<ValidationMessage> messages = new ArrayList<ValidationMessage>();
    XSLTransform schematronTransform = Util.buildSchematronTransform(schematronFile);
    Nodes nodes = schematronTransform.transform(new Document(getXOMElementCopy()));
    Document doc = XSLTransform.toDocument(nodes);

    XPathContext context = XPathContext.makeNamespaceContext(doc.getRootElement());
    String svrlNamespace = context.lookup("svrl");
    Nodes outputNodes = doc.query("//svrl:failed-assert | //svrl:successful-report", context);
View Full Code Here


    // time = new Date().getTime();
    XSLTransform phase3 = getSchematronSvrlTransform(queryBinding);
    // System.out.println((new Date().getTime() - time) + "ms (SVRL)");

    // time = new Date().getTime();
    Nodes nodes = phase3.transform(phase2.transform(phase1.transform(schDocument)));
    // System.out.println((new Date().getTime() - time) + "ms (Base transformation 1, 2, 3)");

    // time = new Date().getTime();
    XSLTransform finalTransform = new XSLTransform(XSLTransform.toDocument(nodes));
    // System.out.println((new Date().getTime() - time) + "ms (Schematron Validation)");
View Full Code Here

   */
  public static Document runXSLOnInline(Document inline, String sheetName) {
    try {
      Document xslDoc = new ResourceGetter("uk/ac/cam/ch/wwmm/oscar3/misc/resources/").getXMLDocument(sheetName);
      XSLTransform xslt = new XSLTransform(xslDoc);
      Nodes n = xslt.transform(inline);
      return XSLTransform.toDocument(n);
    } catch (Exception e) {
      e.printStackTrace();
      return inline;
    }
View Full Code Here

  }
 
  private Document getSciXMLDocInternal() {
    try {
      XSLTransform xslt = new XSLTransform(rg.getXMLDocument("typesToSciXML.xsl"));
      return XSLTransform.toDocument(xslt.transform(typeDoc));
    } catch (Exception e) {
      e.printStackTrace();
      throw new Error("Couldn't make NETypes SciXML");     
    }
  }
View Full Code Here

      Node node = paperNodes.get(i);
      node.detach();
      assert(node instanceof Element);
      Element e = (Element)node;
      Document newDoc = new Document(e);
      Document sciXML = XSLTransform.toDocument(xslt.transform(newDoc));
     
      String title = sciXML.query("/PAPER/CURRENT_TITLE").get(0).getValue().trim();
      assert(title.length() > 0);
      title = title.replaceAll(" ", "_");
      System.out.println(title);
View Full Code Here

      if(true) {
        xml1 = new Builder().build(paper);
     
        PubXMLToSciXML.addNodeIds(xml1.getRootElement(), xml1.getRootElement());
     
        Nodes n = xslt.transform(xml1);
        xml2 = XSLTransform.toDocument(n);
        xa = new XMLAlignment(xml2, xml1, true);
        xa.testXML1ForOscar();
        //new Serializer(System.out).write(xml1);
        //new Serializer(System.out).write(xml2);
View Full Code Here

          System.out.println("rg: " + rg.toString());
         
             Document stylesheet = rg.getXMLDocument("xsl/clearMode2.xsl");
             System.out.println("Found clearMode2.xsl");
             XSLTransform transform = new XSLTransform(stylesheet);
             Document clearDoc = XSLTransform.toDocument(transform.transform(mode2doc));
             ARTSciXMLDocument clearedDoc = ARTSciXMLDocument.makeFromDoc(clearDoc);
             ap.writeMode2Doc(clearedDoc);
             response.setContentType("text/plain");
             response.getWriter().print(name);
             /*mode2doc = ap.getMode2Doc();
View Full Code Here

        if(n.get(i).query(".//PMID").size() == 0) continue;
        String id = n.get(i).query(".//PMID").get(0).getValue();
        Element elem = (Element)n.get(i);
        elem.detach();
        Document d = new Document(elem);
        Document out = XSLTransform.toDocument(xslt.transform(d));
        docs.put(id, SciXMLDocument.makeFromDoc(out));
      } catch (Exception e) {
        e.printStackTrace();
        System.err.println("Hmm, couldn't parse that abstract.");
      }
View Full Code Here

        Document stylesheet = builder.build(literalResultElementAsStylesheet,
          "http://www.example.com");
        XSLTransform transform = new XSLTransform(stylesheet);
        Document doc = builder.build(notAStyleSheet,
              "http://www.example.com");
        Nodes result = transform.transform(doc);
        Element root = (Element) (result.get(0));
        assertEquals("html", root.getQualifiedName());
        assertEquals(2, root.getChildCount());
       
    }
View Full Code Here

        File stylesheet = new File(inputDir, "fragment.xsl");
        Builder builder = new Builder();
        Document stylesheetDoc = builder.build(stylesheet);
        XSLTransform xform = new XSLTransform(stylesheetDoc);
        Document input = builder.build(doc);
        Nodes output = xform.transform(input);
        assertEquals(6, output.size());
        assertEquals(element1, output.get(0));
        assertEquals(element2, output.get(1));
        assertEquals(new Element("element4"), output.get(3));
        assertEquals(new Comment("test"), output.get(4));
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.