Friday, December 13, 2013

XML con HTML+XSL

import javax.xml.transform.*;
import java.io.*;

public class XSL {

 
 public boolean toHTML(){
  
  try 
  {
      TransformerFactory tFactory = TransformerFactory.newInstance();

      Transformer transformer =
        tFactory.newTransformer
           (new javax.xml.transform.stream.StreamSource
              ("style.xsl"));

      transformer.transform
        (new javax.xml.transform.stream.StreamSource
              ("biblioteca.xml"),
         new javax.xml.transform.stream.StreamResult
              ( new FileOutputStream("biblioteca_municipal.html")));
      
      
      return true;
  }
  catch (Exception e) {
      return false;
  }
  
  
 }
 
}

No comments:

Post a Comment