home *** CD-ROM | disk | FTP | other *** search
- <xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:html="http://www.w3.org/TR/html4/loose.dtd"
- exclude-result-prefixes="html"
- version="1.0">
-
- <xsl:import href="ContentTags.xsl"/>
- <xsl:import href="RefLinks.xsl"/>
- <xsl:import href="Variables.xsl"/>
-
- <xsl:output method="html"/>
-
- <xsl:template match="/">
- <html>
- <head>
- <title><xsl:value-of select="assemblyXml/assemblyTitle"/></title>
- </head>
- <body><xsl:apply-templates select="assemblyXml/asmbly"/></body>
- </html>
- </xsl:template>
-
-
- <xsl:template match="asmbly">
- <center><div>
- <xsl:apply-templates select="imgmap | asset"/>
- <xsl:apply-templates select="caption"/>
- <br/>
- <xsl:apply-templates select="credit"/>
- </div></center>
- </xsl:template>
-
-
- <xsl:template match="imgmap">
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="mapcap">
- <xsl:param name="xcnt">
- <xsl:value-of select="count(xref)"/>
- </xsl:param>
-
- <!-- imglink tag will be deleted and replaced by assetlink once we publish new data -->
- <!-- we parse both tags in order to make it backward compatible -->
-
- <xsl:param name="icnt">
- <xsl:value-of select="count(assetlink)"/>
- </xsl:param>
-
- <!-- artlink tag will be deleted and replaced by assemblylink once we publish new data -->
- <!-- we parse both tags in order to make it backward compatible -->
-
- <xsl:param name="acnt">
- <xsl:value-of select="count(assemblylink)"/>
- </xsl:param>
-
- <xsl:choose>
- <!-- combination of imglink and xref -->
- <xsl:when test="$xcnt > 1 and $icnt > 1">
- <table>
- <tr>
- <td width="300" valign="top"><div align="center">
- <xsl:for-each select="assetlink">
- <xsl:apply-templates select="."/><br/>
- </xsl:for-each></div>
- </td>
- <td width="300" valign="top"><div align="center">
- <xsl:for-each select="xref">
- <xsl:apply-templates select="."/><br/>
- </xsl:for-each></div>
- </td>
- </tr>
- </table>
- </xsl:when>
- <xsl:when test="$xcnt >= 1 and $acnt >= 1"><!-- fixed bug from nigeria article's map. -->
- <table>
- <tr>
- <td width="300" valign="top"><div align="center">
- <xsl:for-each select="assemblylink">
- <xsl:apply-templates select="."/><br/>
- </xsl:for-each></div>
- </td>
- <td width="300" valign="top"><div align="center">
- <xsl:for-each select="xref">
- <xsl:apply-templates select="."/><br/>
- </xsl:for-each></div>
- </td>
- </tr>
- </table>
- </xsl:when>
- <!-- xref only -->
- <xsl:when test="$xcnt > 1">
- <xsl:value-of select="text()[position() = 1]"/><p/>
- <xsl:call-template name="linksUnderMap">
- <xsl:with-param name="cnt"><xsl:value-of select="$xcnt"/></xsl:with-param>
- <xsl:with-param name="linktype">xref</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <!-- imglink only -->
- <xsl:when test="$icnt > 1">
- <xsl:call-template name="linksUnderMap">
- <xsl:with-param name="cnt"><xsl:value-of select="$icnt"/></xsl:with-param>
- <xsl:with-param name="linktype">imglink</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <!-- artlink only -->
- <xsl:when test="$acnt > 1">
- <xsl:call-template name="linksUnderMap">
- <xsl:with-param name="cnt"><xsl:value-of select="$acnt"/></xsl:with-param>
- <xsl:with-param name="linktype">artlink</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
-
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="linksUnderMap">
- <xsl:param name="cnt">0</xsl:param>
- <xsl:param name="linktype"></xsl:param>
- <xsl:param name="avecnt" select="round($cnt div 2)"/>
-
- <table>
- <tr>
- <td width="250">
- <xsl:choose>
- <xsl:when test="$linktype = 'xref'">
- <xsl:for-each select="xref">
- <xsl:if test="position() <= $avecnt">
- <xsl:apply-templates select="."/><br/>
- <xsl:value-of select="following-sibling::text()"/><p/>
- </xsl:if>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test="$linktype = 'imglink'">
- <xsl:for-each select="assetlink">
- <xsl:if test="position() <= $avecnt">
- <xsl:apply-templates select="."/><br/>
- </xsl:if>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test="$linktype = 'artlink'">
- <xsl:for-each select="assemblylink">
- <xsl:if test="position() <= $avecnt">
- <xsl:apply-templates select="."/><br/>
- </xsl:if>
- </xsl:for-each>
- </xsl:when>
- </xsl:choose>
- </td>
- <td width="40"/>
- <td valign="top" width="250">
- <xsl:choose>
- <xsl:when test="$linktype = 'xref'">
- <xsl:for-each select="xref">
- <xsl:if test="position() > $avecnt">
- <xsl:apply-templates select="."/><br/>
- <xsl:value-of select="following-sibling::text()"/><p/>
- </xsl:if>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test="$linktype = 'imglink'">
- <xsl:if test="position() > $avecnt">
- <xsl:apply-templates select="."/><br/>
- </xsl:if>
- </xsl:when>
- <xsl:when test="$linktype = 'artlink'">
- <xsl:for-each select="assemblylink">
- <xsl:if test="position() > $avecnt">
- <xsl:apply-templates select="."/><br/>
- </xsl:if>
- </xsl:for-each>
- </xsl:when>
- </xsl:choose>
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <xsl:template match="caphead">
- <p><xsl:apply-templates/></p>
- </xsl:template>
-
- <xsl:template match="p">
- <p><xsl:apply-templates/></p>
- </xsl:template>
-
- <xsl:template match="frac">
- <xsl:apply-templates select="num"/>/<xsl:apply-templates select="den"/>
- </xsl:template>
-
-
- <xsl:template match="credit">
- <i><xsl:apply-templates/></i>
- </xsl:template>
-
- <xsl:template name="new_multimedia">
- <xsl:variable name="filename" select="@filename"/>
- <xsl:variable name="subdir" select="substring-after($filename,'.')"/>
- <xsl:variable name="mediaDir" select="concat('/new-multimedia/',$subdir,'/',$filename)"/>
-
- <xsl:choose>
- <xsl:when test="@bintype='8'">
- <xsl:if test="not(preceding-sibling::*/@bintype='9') and not(following-sibling::*/@bintype='9')">
- <embed src="{$mediaDir}" width="{@wdth}" height="{@hgt}"/>
- </xsl:if>
- </xsl:when>
- <xsl:when test="@bintype='5'">
- <xsl:if test="not(preceding-sibling::*/@bintype='4') and not(following-sibling::*/@bintype='4')">
- <embed src="{$mediaDir}" width="{@wdth}" height="{@hgt}"/>
- </xsl:if>
-
- </xsl:when>
- <xsl:when test="@bintype='20'"> <!-- audio type assembly xml data has width and height=0 -->
- <embed src="{$mediaDir}"/>
- </xsl:when>
- <xsl:otherwise>
- <embed src="{$mediaDir}" width="{@wdth}" height="{@hgt}"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="img">
- <img vspace="6">
- <xsl:attribute name="height"><xsl:value-of select="@hgt"/></xsl:attribute>
- <xsl:attribute name="width"><xsl:value-of select="@wdth"/></xsl:attribute>
-
- <!-- temporary hack until "name" attribute of the map element is fixed -->
- <xsl:if test="@imgmap = 'y'">
- <xsl:attribute name="usemap">#<xsl:value-of select="following-sibling::imgmap/map/@name"/></xsl:attribute>
- </xsl:if>
-
- <xsl:attribute name="src"><xsl:value-of select="$imageURL"/>?id=<xsl:value-of select="@id"/></xsl:attribute>
- <xsl:attribute name="alt"><xsl:value-of select="/asmbly/caption"/></xsl:attribute>
-
- </img>
- </xsl:template>
-
-
- <xsl:template match="asset">
- <xsl:choose>
- <xsl:when test="@bintype > 2">
- <xsl:call-template name="new_multimedia"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="img"/>
- </xsl:otherwise>
- </xsl:choose>
- <br/>
- </xsl:template>
-
- <xsl:template match="map">
- <map name="{@name}"><xsl:apply-templates/></map>
- </xsl:template>
-
- <xsl:template match="area">
- <xsl:choose>
-
- <xsl:when test="@reftype='toc'">
- <xsl:call-template name="area">
- <xsl:with-param name="URL"><xsl:value-of select="$articleURL"/>?tocId=<xsl:value-of select="@refid"/></xsl:with-param>
- </xsl:call-template>
- </xsl:when>
-
- <xsl:when test="@reftype='bin'">
- <xsl:call-template name="area">
- <xsl:with-param name="URL"><xsl:value-of select="$assemblyURL"/>?id=<xsl:value-of select="@refid"/></xsl:with-param>
- </xsl:call-template>
- </xsl:when>
-
- <xsl:when test="@reftype='asm'">
- <xsl:call-template name="area">
- <xsl:with-param name="URL"><xsl:value-of select="$assemblyURL"/>?id=<xsl:value-of select="@refid"/></xsl:with-param>
- </xsl:call-template>
- </xsl:when>
-
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="area">
- <xsl:param name="URL"></xsl:param>
- <area coords="{@coords}" shape="{@shape}" href="{$URL}"/>
- </xsl:template>
-
-
- <xsl:template match="assetlink">
- <a class="artcopybold" href="{$assemblyURL}?id={@binid}&type=I"><xsl:apply-templates/></a>
- </xsl:template>
-
-
- <xsl:template match="assemblylink">
- <a class="artcopybold" href="{$assemblyURL}?id={@asmid}&type=A"><xsl:apply-templates/></a>
- </xsl:template>
-
- </xsl:stylesheet>
-