XALAN and Relative Paths

If you just started using XALAN probably the first issue that you encountered is the fact the relative paths, for the imported XSL files, are not working.
For the relatives path to work, in a XALAN transformation, you will need to set the system identifier (systemID).
The system identifier is nothing else but an URI to the source file, and is set using the StreamSource.setSystemId(String systemID) method.
Following is a simple example that shows how to to set the property for a XSL StreamSource.



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

public class RelativePathExample {

    public static void main(String[] argsthrows Exception {
        final String BASE_PATH = "C:\\Temp\\";

        String xslPathURI = (new File(BASE_PATH + "article.xsl")).toURL()
                .toString();
        StreamSource xslSource = new StreamSource(xslPathURI);
        // this line will be used to solve the URIs encountered in XSL file, 
        // respectively the relative paths of the imported XSL files
        // xslPathURI = "file:/C:/Temp/article.xsl"
        xslSource.setSystemId(xslPathURI);

        String xmlPathURI = (new File(BASE_PATH + "article.xml")).toURL()
                .toString();
        StreamSource xmlSource = new StreamSource(xmlPathURI);

        TransformerFactory tFactory = TransformerFactory.newInstance();
        Transformer transformer = tFactory.newTransformer(xslSource);

        StreamResult result = new StreamResult(new FileOutputStream(BASE_PATH
                "article.html"));
        transformer.transform(xmlSource, result);

    }
}


Curs online AJAX

Toata lumea vorbeste acum de AJAX, AJAX in sus, AJAX in jos, la stanga si la dreapta.

Asa ca cei interesati pot participa din 4.08.2006 la un curs online gratuit de AJAX.
Informatii mai detaliate gasiti aici: AJAX Programming (with Passion!) Online Course.

Pe scurt cursul se desfasoara astfel:

  • profesorul pune la dispozitie o serie de prezentari si documentatii
  • invatacelul trebuie sa le citeasca si sa-ti faca tema
  • exista un grup de discutii pe Yahoo unde se pot pune si raspunde la intrebari.

Sang Shin mai organizeaza, prin intermediul aceluiasi site www.javapassion.com , cursuri gratuite de Java, J2EE, Web Services.


Versiuni Java suportate de gama de produse Lotus

Ce versiuni de Java suporta gama de produse Lotus?
Urmati link-ul urmator:
Lista versiuni Java suportate de produsele Lotus


Pagini
Calendar
September 2010
M T W T F S S
« Jul    
 12345
6789101112
13141516171819
20212223242526
27282930  
Momentan răsfoiţi arhiva cotârlea.ro în categoria 'Java/J2EE'
Categorii
Arhivă