Login   Register  
PHP Classes
elePHPant
Icontem

File: PHPReportCol.xsl

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Eustaquio Rangel de Oliveira Jr.  >  phpreports  >  PHPReportCol.xsl  >  Download  
File: PHPReportCol.xsl
Role: Auxiliary data
Content type: text/plain
Description: Column layer
Class: phpreports
Report Generator
Author: By
Last change:
Date: 11 years ago
Size: 4,941 bytes
 

Contents

Class file image Download
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
	Make columns in the row
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template name="MAKE_COL">
	<!-- 
		inserts an extra tab if its the first col of the row - the other ones needs just
		the remainding tabs
	//-->			  
	<xsl:if test="position()=1 and name(../../..)!='GROUP'">
		<xsl:text>&#9;</xsl:text>
	</xsl:if>
	
	<xsl:choose>
		<xsl:when test="name(../../..)='GROUP' and (name(../..)='HEADER' or name(../..)='FOOTER')">
			<xsl:text>&quot;&lt;td </xsl:text>
		</xsl:when>
		<xsl:otherwise>	
			<xsl:text>&#9;&#9;&#9;print &quot;</xsl:text>
			<xsl:text>&lt;td </xsl:text>
		</xsl:otherwise>	
	</xsl:choose>	

	<!-- call template to deal with most part of parameters -->
	<xsl:call-template name="MAKE_COL_PARMS"/>	

	<!-- if its not on the FIELDS group, close tag here -->
	<xsl:if test="name(../..)!='FIELDS'">
		<xsl:text>&gt;</xsl:text>
	</xsl:if>	

	<!-- call template for the link open tag here -->
	<xsl:call-template name="MAKE_LINK_OPEN"/>
	
	<!-- if have a TEXTCLASS on the element -->	
	<xsl:if test="string-length(@TEXTCLASS)>0">
		<xsl:text>&lt;span class='</xsl:text>
		<xsl:value-of select='@TEXTCLASS'/>
		<xsl:text>'&gt;</xsl:text>
	</xsl:if>

	<!-- need to put a start quote here if its an expression -->
	<xsl:if test="@TYPE='EXPRESSION'">
		<xsl:text>&quot;.</xsl:text>
	</xsl:if>
	
	<xsl:if test="string-length(@NUMBERFORMAT)>0 and name(../..)!='FIELDS'">
		<xsl:text>sprintf( &quot;</xsl:text>
		<xsl:value-of select="@NUMBERFORMAT"/>
		<xsl:text>&quot;, </xsl:text>
	</xsl:if>	

	<xsl:if test="string-length(@NUMBERFORMATEX)>0 and name(../..)!='FIELDS'">
		<xsl:text>number_format( </xsl:text>
	</xsl:if>
	
	<!-- put the value here !!! //-->
	<xsl:if test="name(../..)!='FIELDS'">
		<xsl:value-of select="text()"/>
	</xsl:if>	
	
	<xsl:if test="string-length(@NUMBERFORMAT)>0 and name(../..)!='FIELDS'">
		<xsl:text> )</xsl:text>
	</xsl:if>	
	
	<xsl:if test="string-length(@NUMBERFORMATEX)>0 and name(../..)!='FIELDS'">
		<xsl:text>,</xsl:text>
		<xsl:value-of select="@NUMBERFORMATEX"/>
		<xsl:text>, $this->sDecSep, $this->sThoSep )</xsl:text>
	</xsl:if>	
	
	<xsl:choose>
		<xsl:when test="@TYPE='EXPRESSION'">
			<xsl:text>.&quot;</xsl:text>
		</xsl:when>	
		<xsl:otherwise>
			<xsl:if test="name(../..)!='FIELDS'">
				<!-- calls the XHTML templates here -->
				<xsl:apply-templates select="XHTML"/>
				<xsl:if test="string-length(@TEXTCLASS)>0">
					<xsl:text>&lt;/span&gt;</xsl:text>
				</xsl:if>	
			</xsl:if>	
		</xsl:otherwise>
	</xsl:choose>		

	<!-- call template for the link close tag here -->
	<xsl:call-template name="MAKE_LINK_CLOSE"/>

	<!-- close column -->
	<xsl:text>&lt;/td&gt;&quot;</xsl:text>

	<xsl:choose>
		<xsl:when test="name(../../..)='GROUP' and (name(../..)='HEADER' or name(../..)='FOOTER')">
			<xsl:if test="count(../COL)>1 and (count(preceding-sibling::*)+1)&lt;count(../COL)">
				<xsl:text>.</xsl:text>
			</xsl:if>	
		</xsl:when>
		<xsl:when test="name(../..)!='FIELDS'">
			<xsl:text>;</xsl:text>
		</xsl:when>	
	</xsl:choose>
</xsl:template>

<!--
	Column parameters
-->	
<xsl:template name="MAKE_COL_PARMS">
	<xsl:if test="string-length(@CELLCLASS)>0">
		<xsl:text>class='</xsl:text><xsl:value-of select='@CELLCLASS'/><xsl:text>' </xsl:text>
	</xsl:if>
	<xsl:if test="string-length(@ROWSPAN)>0">
		<xsl:text>rowspan='</xsl:text><xsl:value-of select='@ROWSPAN'/><xsl:text>' </xsl:text>
	</xsl:if>	
	<xsl:if test="string-length(@COLSPAN)>0">
		<xsl:text>colspan='</xsl:text><xsl:value-of select='@COLSPAN'/><xsl:text>' </xsl:text>
	</xsl:if>	
	<xsl:if test="string-length(@ALIGN)>0">
		<xsl:text>align='</xsl:text><xsl:value-of select='@ALIGN'/><xsl:text>' </xsl:text>
	</xsl:if>	
	<xsl:if test="string-length(@VALIGN)>0">
		<xsl:text>valign='</xsl:text><xsl:value-of select='@VALIGN'/><xsl:text>' </xsl:text>
	</xsl:if>	
	<xsl:if test="string-length(@WIDTH)>0">
		<xsl:text>width='</xsl:text><xsl:value-of select='@WIDTH'/><xsl:text>' </xsl:text>
	</xsl:if>	
</xsl:template>

<!--
	Link open tag
-->
<xsl:template name="MAKE_LINK_OPEN">
	<xsl:if test="count(LINK)>0">
		<xsl:text>&lt;a href='</xsl:text>
		<xsl:choose>
			<xsl:when test="LINK/@TYPE='STATIC'">
				<xsl:value-of select="LINK"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="LINK"/>
			</xsl:otherwise>
		</xsl:choose>
		<xsl:text>' </xsl:text>
		<xsl:if test="string-length(LINK/@TARGET)>0">
			<xsl:text>target='</xsl:text>
			<xsl:value-of select="LINK/@TARGET"/>
			<xsl:text>' </xsl:text>
		</xsl:if>
		<xsl:if test="string-length(LINK/@TITLE)>0">
			<xsl:text>title='</xsl:text>
			<xsl:value-of select="LINK/@TITLE"/>
			<xsl:text>' </xsl:text>
		</xsl:if>
		<xsl:text>&gt;</xsl:text>
	</xsl:if>
</xsl:template>	

<!--
	Link close tag
-->
<xsl:template name="MAKE_LINK_CLOSE">
	<xsl:if test="count(LINK)>0">
		<xsl:text>&lt;/a&gt;</xsl:text>
	</xsl:if>
</xsl:template>
	
</xsl:stylesheet>