<?xml version='1.0' ?> <!-- author: gmosx --> <!DOCTYPE shader [ <!ENTITY nbsp "<![CDATA[ ]]>"> <!ENTITY copy "<![CDATA[©]]>"> <!ENTITY euro "<![CDATA[€]]>"> <!ENTITY laquo "<![CDATA[«]]>"> <!ENTITY raquo "<![CDATA[»]]>"> ]> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:x="http://www.navel.gr/xml/shader.xsd" exclude-result-prefixes="x xl" version="1.0"> <!-- parameters and constants --> <!-- <xsl:variable name='css'>style.css</xsl:variable> --> <!-- <xsl:variable name='lang'>el</xsl:variable> --> <!-- strip comments --> <xsl:template match="comment()"> <!-- strip --> </xsl:template> <!-- only copy ruby/r processing instructions --> <xsl:template match='processing-instruction("ruby")'> <xsl:copy/> </xsl:template> <xsl:template match='processing-instruction("r")'> <xsl:copy/> </xsl:template> <xsl:template match='processing-instruction("include")'> <xsl:copy/> </xsl:template> <!-- copy other tags --> <xsl:template match="@* | * | text()"> <xsl:copy> <xsl:apply-templates select="@* | * | text() | processing-instruction()"/> </xsl:copy> </xsl:template> <!-- root element --> <xsl:template match="root"> <xsl:apply-templates/> </xsl:template> <!-- create a new, nested output buffer --> <xsl:template name="x:ob-start" match="x:ob-start"> <ruby> @out_buffers = [] unless @out_buffers @out_buffers.push(@out) @out = "" </ruby> </xsl:template> <!-- close a nested output buffer --> <xsl:template name="x:ob-end" match="x:ob-end"> <ruby> @out = @out_buffers.pop() </ruby> </xsl:template> <!-- close a nested output buffer and write to the parent buffer --> <xsl:template name="x:ob-write-end" match="x:ob-write-end"> <ruby> __nested_buffer = @out @out = @out_buffers.pop() @out += __nested_buffer </ruby> </xsl:template> <!-- NOT WORKING YET --> <xsl:template name="x:cache" match="x:cache"> <xsl:processing-instruction name='ruby'> <![CDATA[__out == __out_buffers.pop()]]> </xsl:processing-instruction> </xsl:template> <!-- rendering errors --> <xsl:template name='x:rendering-errors' match='x:rendering-errors'> <ruby>unless @rendering_errors.empty?</ruby> <div id="rendering-errors"> <h3>RENDERING ERRORS:</h3> #{@rendering_errors.join('<br />')} </div> <ruby>end</ruby> </xsl:template> <!-- form errors temlate --> <xsl:template name='x:form-errors' match='x:form-errors'> <ruby>if errors = request.errors_to_a()</ruby> <div class="errors"><b>ERRORS:</b><br />#{errors.join("<br />")}</div> <ruby>end</ruby> </xsl:template> <xsl:template match='x:cell'> <xsl:apply-templates/> </xsl:template> <xsl:template match="x:clear" name="x:clear"> <div class="clear">.</div> </xsl:template> <!-- admin ui --> <xsl:template name='x:admin-ui' match='x:admin-ui'> <ruby>if admin</ruby> <span class="admin"> <xsl:apply-templates /> </span> <ruby>end</ruby> </xsl:template> <!-- transaction form --> <xsl:template name='x:form-pass-txid' match='x:form-pass-txid'> <input type="hidden" name="txid"> <!-- gmosx: keep in one line! --> <xsl:attribute name="value"><![CDATA[#{request['txid']}]]></xsl:attribute> </input> </xsl:template> <!-- Background dispatcher A clever hack, web actions are performed in the background without redirecting. --> <xsl:template name='x:dispatcher' match='x:dispatcher'> <img id="_dispatch" src="d.gif" alt="" style="display: none" /> <script type="text/javascript"> <![CDATA[ function dispatch(dispatch_url) { d = document.getElementById('_dispatch').src = dispatch_url; } ]]> </script> </xsl:template> <xsl:template name="x:pager-first" match="x:pager-first"> <ruby>unless @pager.page == @pager.first_page</ruby> <a> <xsl:attribute name="href">#{@pager.target_uri(@pager.first_page)}</xsl:attribute> <xsl:apply-templates /> </a> <ruby>end</ruby> </xsl:template> <xsl:template name="x:pager-prev" match="x:pager-prev"> <ruby>unless @pager.page == @pager.first_page</ruby> <a> <xsl:attribute name="href">#{@pager.target_uri(@pager.previous_page)}</xsl:attribute> <xsl:apply-templates /> </a> <ruby>end</ruby> </xsl:template> <xsl:template name="x:pager-next" match="x:pager-next"> <ruby>unless @pager.page == @pager.last_page</ruby> <a> <xsl:attribute name="href">#{@pager.target_uri(@pager.next_page)}</xsl:attribute> <xsl:apply-templates /> </a> <ruby>end</ruby> </xsl:template> <xsl:template name="x:pager-last" match="x:pager-last"> <ruby>unless @pager.page == @pager.last_page</ruby> <a> <xsl:attribute name="href">#{@pager.target_uri(@pager.last_page)}</xsl:attribute> <xsl:apply-templates /> </a> <ruby>end</ruby> </xsl:template> <xsl:template name="x:pager-pages" match="x:pager-pages"> <ruby> for i in @pager.nav_range() if i == @pager.page @out += %|<xsl:apply-templates select="x:pager-selected" />| else @out += %|<xsl:apply-templates select="x:pager-page" />| end end </ruby> </xsl:template> <xsl:template name="x:pager-selected" match="x:pager-selected"> <xsl:apply-templates /> </xsl:template> <xsl:template name="x:pager-page" match="x:pager-page"> <xsl:param name="index"><xsl:value-of select="@index"/></xsl:param> <a> <xsl:attribute name="href">#{@pager.target_uri(i)}</xsl:attribute> <xsl:apply-templates /> </a> </xsl:template> </xsl:stylesheet>