O xml vela neviem ale potrebujem ho (asi s pomocou xslt) zobrazit v browseri. Neviem ale ako mam pracovat s tymi vnutornymi tagmi (ci ako sa to vola). Tu je xml:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<FileListing>
<Directory Name="Auta">
<Directory Name="Nakladne">
<File Name="Vetrieska" />
<File Name="Liaz" />
</Directory>
<Directory Name="Osobne">
<Directory Name="Sportove">
<File Name="Ferari" />
<File Name="Lamborghini" />
</Directory>
<Directory Name="Sedany">
<File Name="Oktavia" />
</Directory>
<Directory Name="Vany">
<File Name="Felicia" />
<File Name="Punto" />
</Directory>
</Directory>
</Directory>
</FileListing>
Malo by to vyzerat asi takto:
Auta
Nakladne
Vetrieska
Liaz
Osobne
Sportove
Ferari
Lamborghini
Sedany
Oktavia
Vany
Felicia
Punto
a) xml subor
b) xsl file ktory popisuje transformaciu xml -> html
c) nastroj/program na xml transformaciu
fragment transformacneho kodu
public void do_XSLT(java.io.OutputStream writer, InputStream xml, InputStream xsl, PortletURL actionURL) throws PortletException
{
try {
// JAXP reads data using the Source interface
Source xmlSource = new StreamSource(xml);
Source xsltSource = new StreamSource(xsl);
// the factory pattern supports different XSLT processors
TransformerFactory transFact = TransformerFactory.newInstance();
Transformer trans = transFact.newTransformer(xsltSource);
trans.setParameter("action_url", actionURL.toString());
trans.transform(xmlSource, new StreamResult(writer));
} catch (Exception e) {
System.out.println(e.toString());
}
}