xml form generator (version from 1/28/2011)
[openemr.git] / contrib / forms / xmlformgen / xslt / report_objects.xslt
blob5e6d2d83c5f7b31f5f0518de9fad6405186d07c6
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!-- Generated by Hand -->
3 <!--
4 Copyright (C) 2011 Julia Longtin <julia.longtin@gmail.com>
6 This program is free software; you can redistribute it and/or
7 Modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
10 -->
12 <!-- templates in this file are meant as manual replacements for the layouts engine. AKA, this file should not be used in pure layout forms. -->
13 <xsl:stylesheet version="1.0"
14 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
15 <!-- the default template for the 'manual' container object -->
16 <xsl:template match="manual">
17 <xsl:text disable-output-escaping="yes"><![CDATA[<!-- display the form's manual based fields -->
18 <table border='0' cellpadding='0' width='100%'>
19 ]]></xsl:text>
20 <xsl:apply-templates select="field|div|section"/>
21 <xsl:text disable-output-escaping="yes"><![CDATA[</table>
22 ]]></xsl:text>
23 </xsl:template>
24 <!-- default section template -->
25 <xsl:template match="section">
26 <xsl:text disable-output-escaping="yes"><![CDATA[<tr><td class='sectionlabel'>]]></xsl:text>
27 <xsl:value-of select="@label"/>
28 <xsl:text disable-output-escaping="yes"><![CDATA[</td>]]></xsl:text>
29 <xsl:if test="count(field) > 0">
30 <xsl:call-template name="consumeRows">
31 <xsl:with-param name="fields" select="field"/>
32 <xsl:with-param name="checked" select="1"/>
33 <xsl:with-param name="consumedcols" select="0"/>
34 <xsl:with-param name="numofCols" select="//style/@cells_per_row"/>
35 </xsl:call-template>
36 </xsl:if>
37 </xsl:template>
38 <xsl:template name="consumeRows">
39 <xsl:param name="fields" />
40 <xsl:param name="checked" />
41 <xsl:param name="consumedcols" />
42 <xsl:param name="numofCols" />
43 <xsl:text disable-output-escaping="yes"><![CDATA[<!-- called consumeRows ]]></xsl:text>
44 <xsl:value-of select="$consumedcols"/>
45 <xsl:value-of select="$checked"/>
46 <xsl:value-of select="$numofCols"/>
47 <xsl:text disable-output-escaping="yes"><![CDATA[--> ]]></xsl:text>
48 <xsl:choose>
49 <!-- exit condition -->
50 <xsl:when test="not($fields)">
51 <xsl:text disable-output-escaping="yes"><![CDATA[<!-- Exiting not($fields)]]></xsl:text>
52 <xsl:value-of select="$numofCols - $consumedcols"/>
53 <xsl:text disable-output-escaping="yes"><![CDATA[-->]]></xsl:text>
54 <xsl:call-template name="EmptyFields">
55 <xsl:with-param name="fields" select="$numofCols - $consumedcols"/>
56 </xsl:call-template>
57 <xsl:text disable-output-escaping="yes"><![CDATA[</tr>
58 ]]></xsl:text>
59 </xsl:when>
60 <xsl:when test="$consumedcols = $numofCols">
61 <xsl:text disable-output-escaping="yes"><![CDATA[</tr>
62 <tr><td valign='top'>&nbsp;</td>]]></xsl:text>
63 </xsl:when>
64 <xsl:otherwise>
65 <xsl:choose>
66 <xsl:when test="not($fields[$checked+1])">
67 <xsl:apply-templates select="$fields[position() &lt;= $checked]"/>
68 <xsl:call-template name="consumeRows">
69 <xsl:with-param name="fields" select="$fields[position() > $checked]"/>
70 <xsl:with-param name="checked" select="$checked"/>
71 <xsl:with-param name="consumedcols" select="$fields[$checked]/@cols + $fields[$checked]/@labelcols + $consumedcols"/>
72 <xsl:with-param name="numofCols" select="$numofCols"/>
73 </xsl:call-template>
74 </xsl:when>
75 <xsl:when test="$fields[$checked]/@cols + $fields[$checked]/@labelcols + $consumedcols = $numofCols">
76 <xsl:apply-templates select="$fields[position() &lt;= $checked]"/>
77 <xsl:text disable-output-escaping="yes"><![CDATA[</tr>
78 <tr><td valign='top'>&nbsp;</td>]]></xsl:text>
79 <xsl:call-template name="consumeRows">
80 <xsl:with-param name="fields" select="$fields[position() > $checked]"/>
81 <xsl:with-param name="checked" select="1"/>
82 <xsl:with-param name="consumedcols" select="0"/>
83 <xsl:with-param name="numofCols" select="$numofCols"/>
84 </xsl:call-template>
85 </xsl:when>
86 <xsl:when test="$fields[$checked]/@cols + $fields[$checked]/@labelcols + $consumedcols > $numofCols">
87 <xsl:apply-templates select="$fields[position() &lt; $checked]"/>
88 <xsl:call-template name="EmptyFields">
89 <xsl:with-param name="fields" select="$numofCols - $consumedcols"/>
90 </xsl:call-template>
91 <xsl:text disable-output-escaping="yes"><![CDATA[</div>
92 <tr><td valign='top'>&nbsp;</td>]]></xsl:text>
93 <xsl:call-template name="consumeRows">
94 <xsl:with-param name="fields" select="$fields[position() >= $checked]"/>
95 <xsl:with-param name="checked" select="1"/>
96 <xsl:with-param name="consumedcols" select="0"/>
97 <xsl:with-param name="numofCols" select="$numofCols"/>
98 </xsl:call-template>
99 </xsl:when>
100 <xsl:otherwise>
101 <xsl:call-template name="consumeRows">
102 <xsl:with-param name="fields" select="$fields"/>
103 <xsl:with-param name="checked" select="$checked+1"/>
104 <xsl:with-param name="consumedcols" select="$fields[$checked]/@cols + $fields[$checked]/@labelcols + $consumedcols"/>
105 <xsl:with-param name="numofCols" select="$numofCols"/>
106 </xsl:call-template>
107 </xsl:otherwise>
108 </xsl:choose>
109 </xsl:otherwise>
110 </xsl:choose>
111 </xsl:template>
112 <xsl:template name="EmptyFields">
113 <xsl:param name="fields"/>
114 <xsl:if test="$fields > 1">
115 <xsl:call-template name="EmptyFields">
116 <xsl:with-param name="fields" select="$fields=1"/>
117 </xsl:call-template>
118 </xsl:if>
119 <xsl:if test="$fields > 0">
120 <xsl:text disable-output-escaping="yes"><![CDATA[<td class='emptycell' colspan='1'></td>]]></xsl:text>
121 </xsl:if>
122 </xsl:template>
123 <xsl:template match="field[@type='checkbox_list' or @type='exams' or @type='textbox' or @type='textarea' or @type='provider' or @type='date' or @type='textfield' or @type='dropdown_list']">
124 <xsl:if test="@labelcols>0">
125 <xsl:text disable-output-escaping="yes"><![CDATA[<td class='fieldlabel' colspan=']]></xsl:text>
126 <xsl:value-of select="@labelcols"/>
127 <xsl:text disable-output-escaping="yes"><![CDATA['><?php echo xl_layout_label(']]></xsl:text>
128 <xsl:value-of select="@label"/>
129 <xsl:text disable-output-escaping="yes"><![CDATA[','e').':'; ?></td>]]></xsl:text>
130 </xsl:if>
131 <xsl:if test="@cols>0">
132 <xsl:text disable-output-escaping="yes"><![CDATA[<td class='text data' colspan=']]></xsl:text>
133 <xsl:value-of select="@cols"/>
134 <xsl:text disable-output-escaping="yes"><![CDATA['><?php echo generate_display_field($manual_layouts[']]></xsl:text>
135 <xsl:value-of select="@name"/>
136 <xsl:text disable-output-escaping="yes"><![CDATA['], $]]></xsl:text>
137 <xsl:value-of select="$fetchrow"/>
138 <xsl:text disable-output-escaping="yes"><![CDATA[[']]></xsl:text>
139 <xsl:value-of select="@name"/>
140 <xsl:text disable-output-escaping="yes"><![CDATA[']); ?></td>]]></xsl:text>
141 </xsl:if>
142 </xsl:template>
143 </xsl:stylesheet>