Commit 90577ae7 authored by Pietro Abate's avatar Pietro Abate

[r2003-05-30 11:01:11 by cvscast] Beppe: new benchs

Original author: cvscast
Date: 2003-05-30 11:01:11+00:00
parent bd3d8397
<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="text()"/>
</xsl:stylesheet>
......@@ -16,13 +16,47 @@ type Speech = <SPEECH>[<SPEAKER> String (Line |Stagedir)+]
type Stagedir = <STAGEDIR> String
type Line = <LINE> [(Char |Stagedir)+];;
include "../../web/xhtml-strict.cd" ;;
let fun xslbench4 (Play -> Xhtml)
<PLAY>[<TITLE>title; rest] ->
<html>[
<head>[<title>title]
<body>[
<h1> title
!transform rest with
| <FM> x -> [<p>[<i>(transform x with <P> y -> y)]]
| <PERSONAE>[<TITLE> t ;r] ->
[
<h2>("Parts - "@t)
!(transform r with
<PERSONA> p -> [<p>[<b>[<i>p]]]
| <PGROUP> x -> transform r with
<PERSONA> p -> [<p>[<b>[<i>p]]])
]
| <ACT>[<TITLE> t; rest] ->
[
<h3>t
!(transform rest with
<SCENE>[<TITLE> t (r::Speech|_)+] ->
[<h3>t
!(transform r with
<SPEECH>[<SPEAKER>s (lines::<LINE>_|_)*] ->
[<p>[<b> s
<br>[]
!transform lines with
<LINE>[(l::Char |_ )+] ->
[!l <br>[]]]])
]
)
]
]
]
match load_xml "testcases/xslbenchdream.xml" with
| x & Play -> "ok"
| x & Play -> print_xml(xslbench4 x)
| _ -> raise "Ma che c%$#^# di file mi hai passato?";;
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)+];;
include "../../web/xhtml-strict.cd" ;;
let fun xslbench4 (Play -> Xhtml)
<PLAY>[<TITLE>title; rest] ->
<html>[
<head>[<title>title]
<body>[
<h1> title
!transform rest with
| <FM> x -> [<p>[<i>(transform x with <P> y -> y)]]
| <PERSONAE>[<TITLE> t ;r] ->
[
<h2>("Parts - "@t)
!(transform r with
<PERSONA> p -> [<p>[<b>[<i>p]]]
| <PGROUP> x -> transform r with
<PERSONA> p -> [<p>[<b>[<i>p]]])
]
| <ACT>[<TITLE> t; rest] ->
[
<h3>t
!(transform rest with
<SCENE>[<TITLE> t (r::Speech|_)+] ->
[<h3>t !(transform r with
<SPEECH>[<SPEAKER>s ;_] -> [<p>[<b> s]])
]
)
]
]
]
match load_xml "testcases/xslbenchBIGdream.xml" with
| x & Play -> print_xml(xslbench4 x)
| _ -> 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