Examples of XSLTransform


Examples of nu.xom.xslt.XSLTransform

   *             if no XSLTransform can be obtained for the given stylesheet;
   *             in particular when the supplied stylesheet is not
   *             syntactically correct XSLT
   */
  protected XSLTransform newTransform(Document stylesheet, TransformerFactory transformerFactory) throws XSLException {
    return new XSLTransform(stylesheet, new NodeFactory(), transformerFactory);
  }
View Full Code Here

Examples of nu.xom.xslt.XSLTransform

   *             syntax error.
   */
  public XSLTransform getTransform(Document stylesheet) throws XSLException {
    if (stylesheet == null)
      throw new IllegalArgumentException("stylesheet must not be null");
    XSLTransform transform = (XSLTransform) entries.get(stylesheet);
    if (transform == null) {
      transform = factory.createTransform(stylesheet);
      entries.put(stylesheet, transform);
    }
    return transform;
View Full Code Here

Examples of nu.xom.xslt.XSLTransform

   */
  public XSLTransform getTransform(File stylesheet) throws XSLException, ParsingException, IOException {
    if (stylesheet == null)
      throw new IllegalArgumentException("stylesheet must not be null");
    Object key = stylesheet;
    XSLTransform transform = (XSLTransform) entries.get(key);
    if (transform == null) {
      transform = factory.createTransform(stylesheet);
      entries.put(key, transform);
    }
    return transform;
View Full Code Here

Examples of nu.xom.xslt.XSLTransform

      throw new IllegalArgumentException("resolver must not be null");
    if (resourceName == null)
      throw new IllegalArgumentException("resourceName must not be null");
   
    Object key = Pool.createHashKeys(new Object[] {resourceName, baseURI});
    XSLTransform transform = (XSLTransform) entries.get(key);
    if (transform == null) {
      InputStream stylesheet = resolver.getResourceAsStream(resourceName);
      if (stylesheet == null) {
        throw new MissingResourceException(
          "Resource '" + resourceName + "' could not be found by resolver: " +
View Full Code Here

Examples of nu.xom.xslt.XSLTransform

    
        Builder builder = new Builder();
        try {
            Document doc = builder.build(args[0]);
            Document stylesheet = builder.build(args[1]);
            XSLTransform transform = new XSLTransform(stylesheet);          
           
            Nodes output = transform.transform(doc);
           
            for (int i = 0; i < output.size(); i++) {
                System.out.print(output.get(i).toXML());               
            }
            System.out.println();
View Full Code Here

Examples of nu.xom.xslt.XSLTransform

      throws ParsingException, IOException, XSLException {
       
        File stylesheet = new File(inputDir, "identity.xsl");
        Builder builder = new Builder();
        Document stylesheetDoc = builder.build(stylesheet);
        XSLTransform xform = new XSLTransform(stylesheetDoc);
        Element root = new Element("root", "http://www.example.org");
        root.appendChild(new Text("some data"));
        root.appendChild(new Element("something"));
        root.addAttribute(new Attribute("test", "test"));
        root.addAttribute(new Attribute("pre:red", "http://www.red.com/", "value"));
        Document input = new Document(root);
        Nodes output = xform.transform(input);
        assertEquals(root, output.get(0));
       
    }
View Full Code Here

Examples of nu.xom.xslt.XSLTransform

           + "<span xmlns:b='http://www.example.net'/>"
           + "</test>";
        File stylesheet = new File(inputDir, "identity.xsl");
        Builder builder = new Builder();
        Document stylesheetDoc = builder.build(stylesheet);
        XSLTransform xform = new XSLTransform(stylesheetDoc);
        Document input = builder.build(doc, "http://example.org/");
        Nodes result = xform.transform(input);
        assertEquals(input.getRootElement(), result.get(0));
       
    }
View Full Code Here

Examples of nu.xom.xslt.XSLTransform

       
        try {
            Builder builder = new Builder();
            Document doc = builder.build(notAStyleSheet,
              "http://www.example.com");
            new XSLTransform(doc);
            /*Document input = builder.build("<root />", "http://example.org/");
            Nodes result = xform.transform(input); */
            fail("Compiled non-stylesheet");
        }
        catch (XSLException success) {
View Full Code Here

Examples of nu.xom.xslt.XSLTransform

        + "</html>\n";
   
        Builder builder = new Builder();
        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

Examples of nu.xom.xslt.XSLTransform

        );
        File doc = new File(inputDir, "8-14.xml");
        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.