The JAIC XSL Transform
This is the XSLT (eXtensible Style Language Transform) script that translates the XML files into HTML for web delivery. It parses the files into various sections; manages the bibliography, figure, and footnoot references, generates the graphical and stylistic layout of the pages along with inserting the appropriate image paths, and creates the navigation links; along with taking care of a number of other housekeeping tasks, such as writing the html meta tags, and hiding unwanted adminstrative references. This script processed the 396 JAIC xml document articles into the 2,841 html pages you see on this website.
<?xml version="1.0"?>
<!-- ******************************************************-->
<!-- Name: JAIC XSL transform -->
<!-- For: AIC Journal Online -->
<!-- Created By: John W. Burke, jb@museumca.org -->
<!-- Created Date: February, 2001 -->
<!-- ******************************************************-->
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:xt="http://www.jclark.com/xt" extension-element-prefixes="xt">
<xsl:output method="html" encoding="ISO-8859-1"/> <xsl:strip-space
elements="*" /> <xsl:preserve-space elements="BIB | ST | CAPTION | FIG | ST
| PUBYR"/>
<--- GLOBAL VARS -->
<xsl:variable name="site_lib_path">/sitelib/</xsl:variable>
<xsl:variable name="site_img_path">/sitelib/img/</xsl:variable>
<xsl:variable name="head.inc"> <xsl:text>#include
virtual="</xsl:text><xsl:value-of
select="concat($site_lib_path,'head.inc')"/><xsl:text>"</xsl:text>
</xsl:variable> <xsl:variable name="nav.inc"> <xsl:text>#include
virtual="</xsl:text><xsl:value-of
select="concat($site_lib_path,'nav.inc')"/><xsl:text>"</xsl:text>
</xsl:variable> <xsl:variable name="foot.inc"> <xsl:text>#include
virtual="</xsl:text><xsl:value-of
select="concat($site_lib_path,'foot.inc')"/><xsl:text>"</xsl:text>
</xsl:variable> <xsl:variable name="file">
<xsl:text>jaic</xsl:text><xsl:value-of
select="//VID"/>-<xsl:value-of
select="format-number(//IID,'00')"/>-<xsl:value-of
select="format-number(substring-after(//AID,'C'),'000')"/>
</xsl:variable> <xsl:variable name="citation">
<xsl:text>JAIC </xsl:text><xsl:value-of
select="//CRYR"/><xsl:text>, Volume </xsl:text><xsl:value-of
select="//VID"/><xsl:text>, Number </xsl:text><xsl:value-of
select="//IID"/><xsl:text>, Article </xsl:text><xsl:value-of
select="substring(//AID,4)"/><xsl:text>
(pp. </xsl:text><xsl:value-of select="//PPF/@FIRST"/><xsl:text>
to </xsl:text><xsl:value-of
select="//PPL/@LAST"/><xsl:text>)</xsl:text>
</xsl:variable> <xsl:variable name="authors">
<xsl:for-each select="//AU">
<xsl:value-of select="FNM"/><xsl:text>
</xsl:text><xsl:value-of select="SNM"/><xsl:if
test="not(position() = last())">, </xsl:if><xsl:if
test="(position() = last()-1)"> & </xsl:if>
</xsl:for-each>
</xsl:variable>
<--- MAIN -->
<xsl:template match="AICART"> <xt:document output="html"
href="{$file}.html">
<xsl:call-template name="page">
<xsl:with-param name="type">entire</xsl:with-param>
</xsl:call-template>
</xt:document> <xsl:choose>
<xsl:when test="string(//ABSTRACT)">
<xsl:for-each select="//ABSTRACT">
<xsl:variable name="language"> <xsl:choose>
<xsl:when test="@LANGUAGE='ES'">s</xsl:when> <xsl:when
test="@LANGUAGE='FR'">f</xsl:when>
<xsl:otherwise>i</xsl:otherwise>
</xsl:choose> </xsl:variable> <xt:document output="html"
href="{$file}_{$language}ndx.html">
<xsl:call-template name="page">
<xsl:with-param name="type">index</xsl:with-param>
</xsl:call-template>
</xt:document>
</xsl:for-each> <xsl:for-each select="BODY//SEC1">
<xt:document output="html"
href="{$file}_{position()}.html">
<xsl:call-template name="page">
<xsl:with-param name="type">section</xsl:with-param>
</xsl:call-template>
</xt:document>
</xsl:for-each>
</xsl:when> <xsl:otherwise>
<xt:document output="html" href="{$file}_indx.html">
<xsl:call-template name="page">
<xsl:with-param name="type">index</xsl:with-param>
</xsl:call-template>
</xt:document>
</xsl:otherwise>
</xsl:choose> <xsl:for-each select="BACK">
<xsl:if test="string()">
<xt:document output="html" href="{$file}_appx.html">
<xsl:call-template name="page">
<xsl:with-param name="type">section</xsl:with-param>
</xsl:call-template>
</xt:document>
</xsl:if>
</xsl:for-each> </xsl:template>
<---- HTML LAYOUT TEMPLATES -->
<xsl:template name="page"> <xsl:param name="type"/> <html>
<head> <xsl:call-template name="meta"/> <title><xsl:value-of
select="$citation"/></title> </head> <body
bgcolor="#ffffff" onload="CSScriptInit();" leftmargin="1"
marginwidth="1" topmargin="1" marginheight="0">
<table border="0" cellpadding="0" cellspacing="0"
width="100%"><xsl:text>
</xsl:text><xsl:comment><xsl:value-of
select="$nav.inc"/></xsl:comment><xsl:text> </xsl:text>
<tr><td valign="middle" align="center"><div
align="left"> <img src="../sitelib/img/spacer.gif" width="12"
height="25" border="0" align="absmiddle"/> <font
size="-1" color="#696969"><xsl:value-of
select="$citation"/> </font> </div></td> <td><div
align="right"> <xsl:if test="not($type='entire')">
<xsl:call-template name="nav_buttons">
<xsl:with-param name="type"><xsl:value-of
select="$type"/></xsl:with-param>
</xsl:call-template> </xsl:if> <br/></div></td></tr>
<tr><td colspan="2" valign="middle"
align="center"><div align="right"> <table border="0"
cellpadding="24" cellspacing="0" width="100%">
<tr><td><div align="center"> <xsl:call-template
name="page_title">
<xsl:with-param name="type"><xsl:value-of
select="$type"/></xsl:with-param>
</xsl:call-template> </div> <xsl:choose>
<xsl:when test="$type='index'">
<xsl:call-template name="index_body"/>
</xsl:when>
<xsl:when test="$type='section'">
<xsl:call-template name="section_body"/>
</xsl:when>
<xsl:when test="$type='entire'">
<xsl:call-template name="entire_body"/>
</xsl:when>
</xsl:choose> </td></tr></table></div></td></tr>
<tr><td> <img src="{$site_img_path}spacer.gif" width="6"
height="25" border="0" align="absmiddle"/> <a
href="#"> <img src="{$site_img_path}top.jpg" width="25"
height="25" border="0" align="middle"/></a></td>
<td align="right"> <xsl:if test="not($type='entire')">
<xsl:call-template name="nav_buttons">
<xsl:with-param name="type"><xsl:value-of
select="$type"/></xsl:with-param>
</xsl:call-template> </xsl:if> </td> </tr></table><hr/>
<small><xsl:value-of select="//CRLN"/></small><xsl:text>
</xsl:text><xsl:comment><xsl:value-of
select="$foot.inc"/></xsl:comment><xsl:text> </xsl:text>
</body> </html> </xsl:template> <xsl:template
name="entire_body"> <xsl:if
test="not(string(//ABSTRACT))"><br/></xsl:if>
<xsl:apply-templates/> <p/> <xsl:choose>
<xsl:when test="string(//ABSTRACT)">
<a href="{$file}_indx.html"><img
src="{$site_img_path}section.jpg" border="0"
align="absmiddle"/> Section Index</a>
</xsl:when>
<xsl:otherwise>
<xsl:if test="string(//BACK)">
<br/><a href="{$file}_indx.html"><img
src="{$site_img_path}entire.jpg" border="0"
align="absmiddle"/> Article Body</a>
</xsl:if>
</xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template
name="section_body">
<br/>
<xsl:apply-templates/>
<xsl:if test="(position()=count(//SEC1))">
<xsl:apply-templates select="//BODY//ACK"/>
</xsl:if>
</xsl:template> <xsl:template name="index_body"> <br/> <xsl:if
test="@LANGUAGE='EN' and string(//ABSTRACT)">ABSTRACT—</xsl:if>
<xsl:apply-templates/> <xsl:if test="string(//ABSTRACT)">
<small><br/> <xsl:if test="not(@LANGUAGE='EN')and
//ABSTRACT[@LANGUAGE='EN']">
[<a href="{$file}_indx.html">English Abstract</a>]
</xsl:if> <xsl:if test="not(@LANGUAGE='ES') and
//ABSTRACT[@LANGUAGE='ES']">
[<a href="{$file}_sndx.html">Spanish Abstract</a>]
</xsl:if> <xsl:if test="not(@LANGUAGE='FR') and
//ABSTRACT[@LANGUAGE='FR']">
[<a href="{$file}_fndx.html">French Abstract</a>]
</xsl:if> </small>
</xsl:if> <xsl:if test="string(//ABSTRACT)">
<br/><p><img src="{$site_img_path}section.jpg"
border="0" align="absmiddle"/> Article Sections:</p>
</xsl:if>
<blockquote> <xsl:if test="string(//ABSTRACT)">
<xsl:for-each select="//SEC1/ST">
<xsl:number level="multiple" count="SEC1"
format="1. "/> <a
href="{$file}_{position()}.html"><xsl:value-of
select="."/></a><br/>
</xsl:for-each>
</xsl:if> <xsl:if test="string(//BACK)">
<xsl:if test="string(//APPM) or string(//NOTEL) or string(//SRCMAT) or
string(//BIBL) or (string(//BIO) and string(//ABSTRACT))">
<xsl:text>a: </xsl:text>
</xsl:if> <xsl:if test="string(//APPM)">
<a href="{$file}_appx.html#APPM">Appendix</a><xsl:text>
</xsl:text> <xsl:if test="string(//NOTEL) or string(//SRCMAT) or
string(//BIBL) or (string(//BIO) and string(//ABSTRACT))">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:if> <xsl:if test="string(//NOTEL)">
<a href="{$file}_appx.html#NOTEL">Notes</a><xsl:text>
</xsl:text> <xsl:if test="string(//SRCMAT) or string(//BIBL) or
(string(//BIO) and string(//ABSTRACT))">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:if> <xsl:if test="string(//SRCMAT)">
<a href="{$file}_appx.html#SRCMAT">Materials</a><xsl:text>
</xsl:text> <xsl:if test="string(//BIBL) or (string(//BIO) and
string(//ABSTRACT))">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:if> <xsl:if test="string(//BIBL)">
<a href="{$file}_appx.html#BIBL">References</a><xsl:text>
</xsl:text> <xsl:if test="string(//BIO) and string(//ABSTRACT)">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:if> <xsl:if test="string(//BIO) and string(//ABSTRACT)">
<a href="{$file}_appx.html#BIO">Author
Information</a><xsl:text> </xsl:text>
</xsl:if>
</xsl:if> </blockquote> <xsl:if test="string(//BACK)">
<a href="{$file}.html"> <img src="{$site_img_path}entire.jpg"
border="0" align="absmiddle"/> Entire Article</a>
</xsl:if> </xsl:template> <xsl:template name="meta"> <meta
http-equiv="content-type" content="text/html;charset=iso-8859-1"/>
<link rel="STYLESHEET" href="{$site_lib_path}jaic.css"
type="text/css"/> <meta name="copyright"
content="permission-implied"/> <meta http-equiv="reply-to"
content="jb@muzeo.com"/> <meta>
<xsl:attribute name="name">DC.Title</xsl:attribute> <xsl:attribute
name="lang">en</xsl:attribute> <xsl:attribute
name="content"><xsl:value-of
select="//ATITLE"/></xsl:attribute>
</meta> <xsl:for-each select="//AU">
<meta>
<xsl:attribute name="name">DC.Creator</xsl:attribute>
<xsl:attribute name="lang">en</xsl:attribute> <xsl:attribute
name="content"><xsl:value-of select="SNM"/><xsl:text>,
</xsl:text><xsl:value-of select="FNM"/></xsl:attribute>
</meta>
</xsl:for-each> <meta>
<xsl:attribute name="name">DC.Date</xsl:attribute> <xsl:attribute
name="lang">en</xsl:attribute> <xsl:attribute
name="content"><xsl:value-of
select="//CRYR"/></xsl:attribute>
</meta> <meta name="DC.Type" lang="en"
content="Text.Article"/> <meta name="DC.Format" lang="en"
content="text/html"/> <meta name="DC.Relation.IsFormatOf"
lang="en" content="{$citation}"/><xsl:text>
</xsl:text><xsl:comment><xsl:value-of
select="$head.inc"/></xsl:comment><xsl:text> </xsl:text>
</xsl:template> <xsl:template name="page_title">
<xsl:param name="type"/>
<xsl:if test="string(//ATITLE)"> <xsl:choose>
<xsl:when test="$type='section'">
<center><h3><xsl:value-of
select="//ATITLE"/></h3></center>
</xsl:when> <xsl:otherwise>
<center><h2><xsl:value-of
select="//ATITLE"/></h2></center>
</xsl:otherwise>
</xsl:choose> </xsl:if> <xsl:if test="string(//ATITLE) and
string($authors)">
<center><h4><xsl:value-of
select="$authors"/></h4></center>
</xsl:if> <p/> </xsl:template>
<--- NAVIGATION GUI -->
<xsl:template name="nav_buttons">
<xsl:param name="type"/>
<--- first -->
<xsl:choose>
<xsl:when test="$type='index'">
<xsl:call-template name="button">
<xsl:with-param name="src">first_off.jpg</xsl:with-param>
</xsl:call-template>
</xsl:when> <xsl:otherwise>
<a href="{$file}_indx.html"> <xsl:call-template
name="button">
<xsl:with-param name="src">first_on.jpg</xsl:with-param>
</xsl:call-template> </a>
</xsl:otherwise>
</xsl:choose>
<--- back -->
<xsl:choose>
<xsl:when test="self::BACK and string(//ABSTRACT)">
<a href="{$file}_{count(//SEC1)}.html"> <xsl:call-template
name="button">
<xsl:with-param name="src">back_on.jpg</xsl:with-param>
</xsl:call-template> </a>
</xsl:when> <xsl:when test="$type='index'">
<xsl:call-template name="button">
<xsl:with-param name="src">back_off.jpg</xsl:with-param>
</xsl:call-template>
</xsl:when> <xsl:when test="position()=1">
<a href="{$file}_indx.html"> <xsl:call-template
name="button">
<xsl:with-param name="src">back_on.jpg</xsl:with-param>
</xsl:call-template> </a>
</xsl:when> <xsl:when test="position()!=1">
<a href="{$file}_{position()-1}.html"> <xsl:call-template
name="button">
<xsl:with-param name="src">back_on.jpg</xsl:with-param>
</xsl:call-template>
</a>
</xsl:when> </xsl:choose>
<--- next -->
<xsl:choose>
<xsl:when test="string(//ABSTRACT) and $type='index'">
<a href="{$file}_1.html"> <xsl:call-template
name="button">
<xsl:with-param name="src">next_on.jpg</xsl:with-param>
</xsl:call-template> </a>
</xsl:when> <xsl:when test="position()!=count(//SEC1) and not(self::BACK) and
not($type='index')">
<a href="{$file}_{position()+1}.html"> <xsl:call-template
name="button">
<xsl:with-param name="src">next_on.jpg</xsl:with-param>
</xsl:call-template> </a>
</xsl:when> <xsl:when test="not(self::BACK) and string(//BACK)">
<a href="{$file}_appx.html"> <xsl:call-template
name="button">
<xsl:with-param name="src">next_on.jpg</xsl:with-param>
</xsl:call-template> </a>
</xsl:when> <xsl:otherwise>
<xsl:call-template name="button">
<xsl:with-param name="src">next_off.jpg</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<--- last -->
<xsl:choose>
<xsl:when test="string(//BACK) and not(self::BACK)"> <a
href="{$file}_appx.html"> <xsl:call-template name="button">
<xsl:with-param name="src">last_on.jpg</xsl:with-param>
</xsl:call-template> </a>
</xsl:when> <xsl:otherwise>
<xsl:call-template name="button">
<xsl:with-param name="src">last_off.jpg</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose> </xsl:template> <xsl:template name="button">
<xsl:param name="src"/> <img src="{$site_img_path}{$src}"
width="25" height="25" border="0"
align="absmiddle"/>
<img src="{$site_img_path}spacer.gif" width="4" height="25"
border="0" align="absmiddle"/> </xsl:template>
<--- HREF ELEMENTS -->
<xsl:template match="//BIBR" >
<a href="{$file}_appx.html#{@HREF}"><xsl:apply-templates/></a>
</xsl:template> <xsl:template match="//NOTER" >
<a
href="{$file}_appx.html#{@HREF}"><em><xsl:apply-templates/></em></a>
</xsl:template> <xsl:template match="//FIGR" >
<a href="#{@HREF}"><xsl:apply-templates/></a>
</xsl:template>
<--- CONTENT BLOCKS -->
<xsl:template match="//CAPTION" >
<xsl:apply-templates/>
</xsl:template> <xsl:template match="ST" >
<br/> <h3><xsl:number level="multiple" count="SEC1 | SEC2 |
SEC3 | SEC4 | SEC5" format="1.1 "/>
<xsl:apply-templates/></h3>
</xsl:template> <xsl:template match="//ABSTRACT" >
<p><xsl:if test="@LANGUAGE='EN'">ABSTRACT—</xsl:if>
<xsl:apply-templates/></p>
</xsl:template> <xsl:template match="//ACK" >
<xsl:if test="string()">
<h3/><hr/><h3>ACKNOWLEDGEMENTS</h3> <xsl:apply-templates/>
</xsl:if> </xsl:template> <xsl:template match="//APPM" >
<xsl:if test="string()">
<a name="APPM"/><br/><h3>APPENDIX</h3>
<xsl:apply-templates/>
</xsl:if> </xsl:template> <xsl:template match="//BIBL" >
<xsl:if test="string()">
<a name="BIBL"/><br/> <xsl:apply-templates/>
</xsl:if> </xsl:template> <xsl:template match="//BIB" >
<a name="{@ID}"/><p> <xsl:apply-templates/></p>
</xsl:template> <xsl:template match="//BIB//PUBYR" >
<xsl:apply-templates/>
</xsl:template> <xsl:template match="//BIB//BKTL" >
<i><xsl:apply-templates/></i>
</xsl:template> <xsl:template match="//SRCMAT" >
<xsl:if test="string()">
<a name="SRCMAT"/><br/> <xsl:apply-templates/>
</xsl:if> </xsl:template> <xsl:template match="//ERRATUM[1]" >
<xsl:if test="string()">
<a name="ERRATUM"/><br/><h3>ERRATA</h3>
<xsl:apply-templates/>
</xsl:if> </xsl:template> <xsl:template match="//BIO" >
<xsl:apply-templates/>
</xsl:template> <xsl:template match="//BIO[1]" >
<xsl:if test="string()"> <a
name="BIO"/><br/><h3>AUTHOR INFORMATION</h3>
<xsl:apply-templates/>
</xsl:if> </xsl:template> <xsl:template match="//NOTEL" >
<xsl:if test="string()"> <a
name="NOTEL"/><br/><h3>NOTES</h3> <xsl:for-each
select="NOTE">
<a name="{@ID}"/><P><xsl:value-of
select="NUMBER"/><xsl:text>. </xsl:text>
<xsl:apply-templates/></P>
</xsl:for-each>
</xsl:if> </xsl:template> <xsl:template match="//NOTE/P"
priority="5" >
<xsl:apply-templates/>
</xsl:template>
<--- STYLE BLOCKS -->
<xsl:template match="//I" >
<i><xsl:apply-templates/></i>
</xsl:template> <xsl:template match="QD" >
<blockquote><xsl:apply-templates/></blockquote>
</xsl:template> <xsl:template match="//L" >
<xsl:choose>
<xsl:when test="@TYPE='bull' or @TYPE='dash' or @TYPE='none' or @TYPE='generic'
or @TYPE='refbull'">
<UL><xsl:apply-templates match="."/></UL>
</xsl:when> <xsl:otherwise> <OL><xsl:apply-templates
match="."/></OL> </xsl:otherwise> </xsl:choose>
</xsl:template> <xsl:template match="//LI" >
<LI><xsl:value-of select="."/></LI>
</xsl:template> <xsl:template match="//LI[P]" >
<LI><xsl:value-of select="."/></LI>
</xsl:template> <xsl:template match="//PBRK" >
<page>
<xsl:attribute name="number"><xsl:number count="//PBRK"
level="any"/></xsl:attribute>
</page>
</xsl:template> <xsl:template match="BODY//P | BACK//P" >
<p><xsl:apply-templates/></p>
</xsl:template>
<--- GRAPHIC BLOCKS -->
<xsl:template match="//FIG | //PLT | //DIA | //TAB | //TBL | //EQN | //UTBL | //UTAB |
//UEQN" >
<a name="{@ID}"/> <CENTER><TABLE class="img">
<CAPTION align="bottom"><small>
<xsl:choose>
<xsl:when test="//FIG">
<xsl:text>Fig. </xsl:text>
</xsl:when> <xsl:when test="//PLT">
<xsl:text>Plate </xsl:text>
</xsl:when> <xsl:when test="//DIA">
<xsl:text>Diagram </xsl:text>
</xsl:when> <xsl:when test="//TAB | //TBL">
<xsl:text>Table </xsl:text>
</xsl:when> <xsl:when test="//EQN">
<xsl:text>Equation </xsl:text>
</xsl:when>
</xsl:choose>
<xsl:if test="//FIG | //PLT | //DIA | //TAB | //TBL | //EQN">
<xsl:value-of select="NUMBER"/>.
</xsl:if> <xsl:apply-templates/>
</small></CAPTION><TR><TD>
<xsl:choose>
<xsl:when test="//FIG | //PLT">
<img src="../img/{$file}-{GRAPHIC/@NAME}.jpg"/>
</xsl:when> <xsl:otherwise>
<img src="../img/{$file}-{GRAPHIC/@NAME}.gif"/>
</xsl:otherwise>
</xsl:choose>
</TD></TR></TABLE></CENTER>
</xsl:template>
<--- HIDDEN ELEMENTS -->
<xsl:template match="//BIO//ST" >
</xsl:template>
<xsl:template match="//ISSUE | //ARTINFO | //TITGRP | //AUGRP" >
</xsl:template> <xsl:template match="//NUMBER" >
</xsl:template>
</xsl:transform>
|
|