|
Xalan
Xalan is a library that converts XML files to HTML or other XML files using XSL stylesheets
Using the Software Let us say that you have an XML file named "my.xml" and an XSL stylesheet named "my.xsl" and you wish to convert your XML file to HTML format. Here are two ways to do it: Execute Xalan directly on Ovid:
Apply the XSL stylesheet and directly display the resulting HTML file on the Web:
<html>
<!-- A simple form that calls "xalan.cgi" to convert an XML file -->
<!-- to HTML via an XSL stylesheet -->
<h2> Convert an XML file to HTML Using an XSL Stylesheet </h2>
<form action="xalan.cgi" method="post">
<table cellpadding="3" border="0">
<tr><td>XML File: </td> <td> <input type="text" name="xml"> </td> </tr>
<tr><td>XSL File: </td> <td> <input type="text" name="xsl"> </td> </tr>
<tr><td> </td> <td> <input type="submit"> </td> <td> </td> </tr>
</table>
</form>
</html>
- Create a CGI file named "xalan.cgi" that looks like this:
#!/usr/local/bin/perl
#
# Accepts an XML and an XSL file as inputs, and converts the XML to
# HTML using the XSL stylesheet.
#
use CGI;
$query = new CGI;
my $xml = $query->param("xml"); chomp($xml); # Get the XML file
my $xsl = $query->param("xsl"); chomp($xsl); # Get the XSL file
print "Content-type: text/html\n\n";
system("/usr/local/xalan/bin/Xalan $xml $xsl") || print "oops! ";
warn $@ if $@;
exit(0);
- Then execute the HTML file on the Web and supply the "my.xml" and "my.xsl" files as arguments and it will display the resulting HTML file.
Technical Support (software installed November 2005)
|
|||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||