CSTUG

Stylesheet

<xsl:stylesheet exclude-result-prefixes="c xi xs saxon" extension-element-prefixes="saxon" version="2.0">

<!-- This is a generic stylesheet for transforming the XML+XSL files into an HTML view. It requires Saxon v.8 but may partially work with other XSLT2 aware processors. -->
<xsl:import href="index2.xsl"/> <xsl:import href="auth.xsl"/> <xsl:import href="kwd2.xsl"/> <xsl:import href="xmlink2.xsl"/> <xsl:include href="acro.xsl"/> <xsl:param name="maxcol" as="xs:integer" select="70"/> <xsl:output method="html" indent="no" encoding="utf-8" saxon:character-representation="native"/> <xsl:preserve-space elements="c:text c:TeX c:html"/> <xsl:variable name="acromode">html</xsl:variable> <xsl:template match="/"> <xsl:variable name="title"> <xsl:choose> <xsl:when test="xsl:stylesheet"> <table width="100%" border="0"> <tr valign="middle"> <td align="left" width="182"> <a href="http://bulletin.cstug.cz/xml/"> <img src="logo.gif" border="0" height="51" width="165" alt="CSTUG" align="left"/> </a> </td> <td> <h1>Stylesheet</h1> </td> </tr> </table> </xsl:when> <xsl:otherwise> <table width="100%" border="0"> <tr valign="middle"> <td> <h1>Zpravodaj Československého sdružení uživatelů T<sub>E</sub>Xu</h1> </td> <td align="right"> <a href="http://bulletin.cstug.cz/xml/"> <img src="logo.gif" border="0" height="51" width="165" alt="CSTUG" align="right"/> </a> </td> </tr> </table> </xsl:otherwise> </xsl:choose> </xsl:variable> <html> <head> <title>CSTUG: XML + XSL files</title> <style type="text/css"> .comment { color: rgb(11,44,204); background-color: yellow; padding: 2pt 5pt 1pt 5pt; border: 2pt solid red; margin: 2pt .1pt 4pt .1pt; } </style> </head> <body background="back_narrow.gif" bgcolor="#ffffff" text="#000000" alink="#c14242" vlink="#d30000" link="#900000"> <table border="0" width="100%"> <tr valign="top"> <td width="30"> </td> <td><xsl:copy-of select="$title"/> <pre> <xsl:apply-templates/> </pre> <p><xsl:call-template name="xmlink"/></p> </td></tr></table> </body> </html> </xsl:template> <xsl:template match="comment()"> <div class="comment"><!--<xsl:value-of select="."/>--></div> </xsl:template> <xsl:template match="c:article[position()!=1]"> <hr/> <xsl:call-template name="any"/> </xsl:template> <xsl:template match="c:author|c:keyword" name="c-ak"> <xsl:value-of select="concat('<', name(), '>')"/> <xsl:apply-imports/> <xsl:value-of select="concat('</', name(), '>')"/> </xsl:template> <xsl:template match="*" name="any"> <xsl:text><</xsl:text><xsl:value-of select="name()"/> <xsl:apply-templates select="@*"/> <xsl:choose> <xsl:when test="count(*)=0 and string-length(normalize-space(.))=0"> <xsl:text>/></xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>></xsl:text> <xsl:apply-templates/> <xsl:text></</xsl:text><xsl:value-of select="name(.)"/><xsl:text>></xsl:text> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="c:index/@toc|c:index/@authors|c:index/@acronyms|c:index/@keywords"> <xsl:text/> <xsl:value-of select="name()"/> <xsl:text>="</xsl:text> <a title="{name()}"> <xsl:attribute name="href"> <xsl:choose> <xsl:when test="ends-with(., '/')"> <xsl:value-of select="concat(../@base, .)"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat(../@base, ., $add-ext)"/> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:value-of select="."/> </a> <xsl:text>"</xsl:text> </xsl:template> <xsl:template match="@indexhref|@href|@pdfref"> <xsl:text/> <xsl:value-of select="name()"/> <xsl:text>="</xsl:text> <xsl:choose> <xsl:when test="matches(., '\{.*\}')"> <xsl:value-of select="."/> </xsl:when> <xsl:otherwise> <a title="{concat(name(), ' = ', .)}"> <xsl:attribute name="href"> <xsl:choose> <xsl:when test="matches(., '(html|pdf|sty|/)$')"> <xsl:value-of select="."/> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat(., $add-ext)"/> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:value-of select="."/> </a> </xsl:otherwise> </xsl:choose> <xsl:text>"</xsl:text> </xsl:template> <xsl:template match="@*"> <xsl:text/> <xsl:value-of select="name()"/> <xsl:text>="</xsl:text> <xsl:choose> <xsl:when test="string-length(.) <= $maxcol"> <xsl:value-of select="."/> </xsl:when> <xsl:otherwise> <xsl:analyze-string select="." regex="(.{{1,{$maxcol}}})\s+"> <xsl:matching-substring> <xsl:value-of select="concat(regex-group(1), " ")"/> </xsl:matching-substring> <xsl:non-matching-substring> <xsl:value-of select="."/> </xsl:non-matching-substring> </xsl:analyze-string> </xsl:otherwise> </xsl:choose> <xsl:text>"</xsl:text> </xsl:template> </xsl:stylesheet>

csbulweb2.xsl