Commit ab049c40 authored by Pietro Abate's avatar Pietro Abate

[r2003-05-29 23:06:05 by cvscast] added xslt benchs

Original author: cvscast
Date: 2003-05-29 23:06:11+00:00
parent 153b614f
type Table = <table>[Row*] ;;
type Row = <row> [
<id>[PCDATA]
<firstname>[PCDATA]
<lastname>[PCDATA]
<street>[PCDATA]
<city>[PCDATA]
<state>[PCDATA]
<zip>[PCDATA]
] ;;
include "../../web/xhtml-strict.cd" ;;
let fun identity (x : Table) : Table = x;;
match load_xml "testcases/db10000.xml" with
| x & Table -> print_xml(identity x)
| _ -> raise "Ma che c%$#^# di file mi hai passato?";;
<?xml version="1.0"?>
<table>
<row>
<id>0000</id>
<firstname>Al</firstname>
<lastname>Aranow</lastname>
<street>1 Any St.</street>
<city>Anytown</city>
<state>AL</state>
<zip>22000</zip>
</row>
<row>
<id>0001</id>
<firstname>Bob</firstname>
<lastname>Aranow</lastname>
<street>2 Any St.</street>
<city>Anytown</city>
<state>AL</state>
<zip>22000</zip>
</row>
<row>
<id>0002</id>
<firstname>Charles</firstname>
<lastname>Aranow</lastname>
<street>3 Any St.</street>
<city>Anytown</city>
<state>AL</state>
<zip>22000</zip>
</row>
<row>
<id>0003</id>
<firstname>David</firstname>
<lastname>Aranow</lastname>
<street>4 Any St.</street>
<city>Anytown</city>
<state>AL</state>
<zip>22000</zip>
</row>
<row>
<id>0004</id>
<firstname>Egon</firstname>
<lastname>Aranow</lastname>
<street>5 Any St.</street>
<city>Anytown</city>
<state>AL</state>
<zip>22000</zip>
</row>
<row>
<id>0005</id>
<firstname>Farbood</firstname>
<lastname>Aranow</lastname>
<street>6 Any St.</street>
<city>Anytown</city>
<state>AL</state>
<zip>22000</zip>
</row>
<row>
<id>0006</id>
<firstname>George</firstname>
<lastname>Aranow</lastname>
<street>7 Any St.</street>
<city>Anytown</city>
<state>AL</state>
<zip>22000</zip>
</row>
<row>
<id>0007</id>
<firstname>Hank</firstname>
<lastname>Aranow</lastname>
<street>8 Any St.</street>
<city>Anytown</city>
<state>AL</state>
<zip>22000</zip>
</row>
<row>
<id>0008</id>
<firstname>Inki</firstname>
<lastname>Aranow</lastname>
<street>9 Any St.</street>
<city>Anytown</city>
<state>AL</state>
<zip>22000</zip>
</row>
<row>
<id>0009</id>
<firstname>James</firstname>
<lastname>Aranow</lastname>
<street>10 Any St.</street>
<city>Anytown</city>
<state>AL</state>
<zip>22000</zip>
</row>
</table>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" encoding="utf-8"/>
<xsl:template match="row[id='0432']">
<html>
<head bgcolor="#ffffff">
</head>
<body>
<table border="0">
<tr>
<td colspan="2" bgcolor="#000000">
<font color="#ffffff">
<xsl:value-of select="concat('personel record #', id)"/>
</font>
</td>
</tr>
<tr>
<td bgcolor="#888888">
First Name:
</td>
<td bgcolor="#dddddd">
<xsl:value-of select="firstname"/>
</td>
</tr>
<tr>
<td bgcolor="#888888">
Last Name:
</td>
<td bgcolor="#dddddd">
<xsl:value-of select="lastname"/>
</td>
</tr>
<tr>
<td bgcolor="#888888">
Street:
</td>
<td bgcolor="#dddddd">
<xsl:value-of select="street"/>
</td>
</tr>
<tr>
<td bgcolor="#888888">
City:
</td>
<td bgcolor="#dddddd">
<xsl:value-of select="city"/>
</td>
</tr>
<tr>
<td bgcolor="#888888">
State:
</td>
<td bgcolor="#dddddd">
<xsl:value-of select="state"/>
</td>
</tr>
<tr>
<td bgcolor="#888888">
Zip
</td>
<td bgcolor="#dddddd">
<xsl:value-of select="zip"/>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="utf-8"/>
<xsl:template match="/">
<!--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">-->
<!-- saved from url=(0042)http://www.tfi-technology.com/products.htm -->
<HTML>
<HEAD>
<TITLE>TFI Technology Products</TITLE>
<META content="text/html; charset=windows-1252" http-equiv="Content-Type"/>
<META content="Memory, Boost, Performance, Memory+, Memory Plus, Crash Protection, StayAlive, Crash, Protector, Crash Protector, TFI, TFI Technology, WatchOut , Access Violation, General Protection Fault, Application Hang, GPF, Screen Freeze, Freeze, Page Fault, Application Recovery, Crash of the Week, Well Known Bug, Bug, Cache, RAM, Virtual Memory, VCache, Memory Tuning, SIMMS, Page File, page faults" name="keywords"/>
<META content="TFI Technology Ltd, Home of StayAlive, the premier crash protection software and Memory+ the total memory control system." name="description"/>
<META content="MSHTML 5.00.2920.0" name="GENERATOR"/>
<META content="(c) 1998-2000, TFI Technology Ltd" name="copyright"/>
<META content="TFI Technology" name="author"/>
<META content="1 day" name="revisit-after"/>
<META content="ALL" name="Robot"/>
<META content="General" name="rating"/>
<META content="TFI Technology Ltd Home of StayAlive, the premier crash protection software." name="DC.Title"/>
<META content="TFI Technology" name="DC.Creator"/>
<META content="TFI Technology Ltd Home of StayAlive, the premier crash protection software." name="DC.Description"/>
<META content="TFI Technology" name="DC.Publisher"/>
<META content="TFI Technology" name="DC.Contributors"/>
<SCRIPT language="JavaScript">
<![CDATA[
if (document.images)
{
var imgBannerPreload = new Image();
imgBannerPreload.src="images/AboutBanner.gif";
var imgWaterMarkPreload = new Image();
imgWaterMarkPreload.src="images/WaterMark.gif";
var imgAboutPreload = new Image();
imgAboutPreload.src="images/abouttfism.gif";
var imgAboutSelPreload = new Image();
imgAboutSelPreload.src = "images/abouttfism_sel.gif"
var imgBuyNowPreload = new Image();
imgBuyNowPreload.src="images/buynowsm.gif";
var imgBuyNowSelPreload = new Image();
imgBuyNowSelPreload.src = "images/buynowsm_sel.gif"
var imgDownloadsPreload = new Image();
imgDownloadsPreload.src="images/downloadssm.gif";
var imgDownloadsSelPreload = new Image();
imgDownloadsSelPreload.src = "images/downloadssm_sel.gif"
var imgProductsPreload = new Image();
imgProductsPreload.src="images/productssm.gif";
var imgProductsSelPreload = new Image();
imgProductsSelPreload.src = "images/productssm_sel.gif"
var imgNewswirePreload = new Image();
imgNewswirePreload.src="images/newswiresm.gif";
var imgNewswireSelPreload = new Image();
imgNewswireSelPreload.src = "images/newswiresm_sel.gif"
}
function img_preload(imgName)
{
if (document.images)
{
var imgPreload = new Image();
imgPreload.src="images/" + imgName;
}
}
function act(imgName)
{
if (document.images)
{
document.images[imgName].src = eval("img" + imgName + "SelPreload.src");
}
}
function inact(imgName)
{
if (document.images)
{
document.images[imgName].src = eval("img" + imgName + "Preload.src");
}
}
//
]]>
</SCRIPT>
</HEAD>
<BODY background="TFI Technology Products_files/WaterMark.gif" bgColor="#ffffff" bgProperties="fixed">
<TABLE border="0" cellPadding="0" cellSpacing="0" height="516" width="125">
<TBODY>
<TR>
<TD colSpan="2" height="95">
<!--webbot bot="ImageMap" startspan
rectangle="(0,5) (68,94) index.htm" src="images/ProductsBanner.gif" width="569"
height="97" border="0" alt="TFI Technology Products" -->
<MAP name="FrontPageMap0">
<AREA href="http://www.tfi-technology.com/index.htm"/>
</MAP>
<IMG alt="TFI Technology Products" border="0" height="97" src="TFI Technology Products_files/ProductsBanner.gif" useMap="#FrontPageMap0" width="569"/>
<!--webbot bot="ImageMap"
i-checksum="26" endspan -->
</TD>
</TR>
<TR>
<TD align="left" height="450" vAlign="top" width="100">
<TABLE border="0" cellPadding="4" cellSpacing="0" width="100%">
<TBODY>
<TR>
<TD height="223" vAlign="top" width="6%"> 
<P>
<IMG align="middle" height="120" src="TFI Technology Products_files/vbarsm.gif" width="3"/>
</P>
</TD>
<TD background="TFI Technology Products_files/bar2.gif" height="223" vAlign="top" width="94%"> 
<P>
<A href="http://www.tfi-technology.com/products.htm" onmouseout="inact('Products')" onmouseover="act('Products')">
<IMG align="middle" alt="Products" border="0" height="20" hspace="0" name="Products" src="TFI Technology Products_files/productssm.gif" width="95"/>
<BR/>
</A>
<A href="http://www.tfi-technology.com/downloads.htm" onmouseout="inact('Downloads')" onmouseover="act('Downloads')">
<IMG align="middle" alt="Downloads" border="0" height="20" hspace="0" name="Downloads" src="TFI Technology Products_files/downloadssm.gif" width="95"/>
<BR/>
</A>
<A href="http://www.tfi-technology.com/buynow.htm" onmouseout="inact('BuyNow')" onmouseover="act('BuyNow')">
<IMG align="middle" alt="Buy Now" border="0" height="20" hspace="0" name="BuyNow" src="TFI Technology Products_files/buynowsm.gif" width="95"/>
<BR/>
</A>
<A href="http://www.tfi-technology.com/about.htm" onmouseout="inact('About')" onmouseover="act('About')">
<IMG align="middle" alt="About TFI" border="0" height="20" hspace="0" name="About" src="TFI Technology Products_files/abouttfism.gif" width="95"/>
<BR/>
</A>
<A href="http://www.tfi-technology.com/newsroom.htm" onmouseout="inact('Newswire')" onmouseover="act('Newswire')">
<IMG align="middle" alt="News Room" border="0" height="20" hspace="0" name="Newswire" src="TFI Technology Products_files/newswiresm.gif" width="95"/>
</A>
</P>
</TD>
</TR>
<TR>
<TD align="center" colSpan="2"> 
<FORM action="http://cgi.www.tfi-technology.com/cgi-bin/www.tfi-technology.com/subscribe.pl" method="post">
<P>
<FONT face="Arial, Helvetica, sans-serif" size="1">
<B>Keep up to date!</B>
<BR/>Submit your e-mail address below.
<BR/>
<INPUT name="email" size="12"/>
<INPUT name="B1" type="submit" value="Submit"/>
<BR/>
</FONT>
</P>
</FORM>
</TD>
</TR>
<TR>
<TD colSpan="2" width="100"> 
<P> </P>
<P> </P>
<P>
<FONT face="Arial, Helvetica, sans-serif" size="1">Copyright ©
<BR/>1998-2000
<BR/>TFI Technology Ltd
<BR/>
<A href="mailto:enquiry@tfi-technology.com">Mail Us</A>
</FONT>
</P>
</TD>
</TR>
</TBODY>
</TABLE>
</TD>
<TD align="left" height="450" vAlign="top" width="464">
<TABLE border="0" cellPadding="0" cellSpacing="0" width="464">
<TBODY>
<TR>
<TD width="78"/>
<TD vAlign="top" width="386">  </TD>
</TR>
</TBODY>
</TABLE>
<xsl:apply-templates/>
<P align="left">
<IMG alt="hbar.gif (979 bytes)" height="8" src="TFI Technology Products_files/hbar.gif" width="458"/>
</P>
</TD>
</TR>
</TBODY>
</TABLE>
</BODY>
</HTML></xsl:template>
<xsl:template match="table"><CENTER><TABLE border="3" cellpadding="3">
<xsl:apply-templates/>
</TABLE></CENTER></xsl:template>
<xsl:template match="row"><TR><xsl:apply-templates/></TR></xsl:template>
<xsl:template match="column"><TD><xsl:apply-templates/></TD></xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="utf-8"/>
<xsl:template match="PLAY">
<html>
<head>
<title>
<xsl:value-of select="/PLAY/TITLE"/>
</title>
</head>
<body>
<h1><xsl:value-of select="/PLAY/TITLE"/></h1>
<xsl:apply-templates select="FM|PERSONAE|ACT"/>
</body>
</html></xsl:template>
<xsl:template match="FM"><i><xsl:apply-templates/></i></xsl:template>
<xsl:template match="PERSONAE"><h2>Parts - <xsl:value-of select="TITLE"/></h2>
<xsl:apply-templates select=".//PERSONA" />
</xsl:template>
<xsl:template match="PERSONA"><p><b><i><xsl:value-of select="."/></i></b></p></xsl:template>
<xsl:template match="ACT"><h3><xsl:value-of select="TITLE"/></h3>
<xsl:apply-templates select="SCENE"/>
</xsl:template>
<xsl:template match="SCENE"><h3><xsl:value-of select="TITLE"/></h3>
<xsl:apply-templates select="SPEECH"/></xsl:template>
<xsl:template match="SPEAKER"><p><b><xsl:value-of select="."/></b></p></xsl:template>
<xsl:template match="LINE"><xsl:value-of select="."/><br/></xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="utf-8"/>
<xsl:template match="PLAY">
<html>
<head>
<title>
<xsl:value-of select="/PLAY/TITLE"/>
</title>
</head>
<body>
<h1><xsl:value-of select="/PLAY/TITLE"/></h1>
<table>
<xsl:for-each select="//ACT">
<xsl:variable name="act" select="TITLE"/>
<xsl:for-each select="SCENE">
<xsl:value-of select="concat($act,' - ',TITLE,' ')"/>
Has <xsl:value-of select="count(.//SPEECH)"/> speeches
with an average of <xsl:value-of select="round(count(.//LINE) div count(.//SPEECH))"/>
line(s) each.
<br/>
</xsl:for-each>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
This diff is collapsed.
type Play = <PLAY>[
Title
Header
Personae
<SCNDESCR>String
<PLAYSUBT>String
Act+]
type Title = <TITLE> String
type Header = <FM>[(<P>String)*]
type Personae =<PERSONAE>[Title (Persona | Pgroup)+]
type Pgroup = <PGROUP>[Persona Persona+ <GRPDESCR>String]
type Persona = <PERSONA>String
type Act = <ACT>[ Title Scene+ ]
type Scene = <SCENE> [Title (Stagedir | Speech)+]
type Speech = <SPEECH>[<SPEAKER> String (Line |Stagedir)+]
type Stagedir = <STAGEDIR> String
type Line = <LINE> [(Char |Stagedir)+];;
match load_xml "testcases/xslbenchdream.xml" with
| x & Play -> "ok"
| _ -> raise "Ma che c%$#^# di file mi hai passato?";;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment