mdxpivot.xsl 3.3 KB
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
<?xml version="1.0"?>
<!--
$Id: //open/mondrian/webapp/WEB-INF/mdxpivot.xsl#3 $

This software is subject to the terms of the Common Public License
Agreement, available at the following URL:
http://www.opensource.org/licenses/cpl.html.
(C) Copyright 2002-2005 Kana Software, Inc. and others.
All Rights Reserved.
You must accept the terms of that agreement to use this software.

Formats an MDX query result into an interactive pivot table. See also
mdxtable.xsl, which produces a similar output, but without hyperlinks.
-->

<!DOCTYPE xsl:stylesheet [
  <!ENTITY nbsp "&#160;">
  <!ENTITY amp "&#046;">
]>

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:tt="http://www.tonbeller.com/bii/treetable"
>

<xsl:output method="html" indent="yes"/>


<xsl:template match="mdxtable">

 <style type="text/css">
   <xsl:text>

/* top columns */
th.column-heading {
  background-color : #DEE3EF;
  font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
  font-size :10pt;
  color : Black;
}

/* row headings */
th.row-heading-even {
  background-color : #DEE3EF;
  font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
  font-size :10pt;
  color : Black;
}

th.row-heading-odd {
  background-color : #EEF3FF;
  font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
  font-size :10pt;
  color : Black;
}

th.row-heading-span {
  background-color : #DEE3EF;
  font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
  font-size :10pt;
  color : Black;
}

/* data cells */
td.cell-even {
  background-color : #f0f0f0;
  font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
  font-size :10pt;
  color : Black;
}
td.cell-odd {
  background-color : #ffffff;
  font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
  font-size :10pt;
  color : Black;
}
   </xsl:text>
 </style>



  <table border="1" cellspacing="0" cellpadding="2">
    <xsl:apply-templates select="head"/>
    <xsl:apply-templates select="body"/>
  </table>

</xsl:template>


<xsl:template match="head | body">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="row">
  <tr>
    <xsl:apply-templates/>
  </tr>
</xsl:template>

<xsl:template match="corner">
  <th nowrap="nowrap" class="column-heading" colspan="{@colspan}" rowspan="{@rowspan}">
    <xsl:text>&nbsp;</xsl:text>
  </th>
</xsl:template>


<xsl:template match="column-heading">
  <th nowrap="nowrap" class="column-heading" colspan="{@colspan}" rowspan="{@rowspan}">
    <xsl:value-of select="@caption"/>
  </th>
</xsl:template>


<xsl:template match="row-heading">
  <th align="left" nowrap="nowrap" class="row-heading-{@style}" colspan="{@colspan}" rowspan="{@rowspan}">
    <!--xsl:value-of select="@depth"/ -->
    <xsl:variable name="n"><xsl:value-of select="@depth"/></xsl:variable>
    <div style="margin-left: {$n}em">
    <a>
      <xsl:attribute name="href">mdxquery?query=pivotQuery&amp;operation=expand&amp;member=<xsl:value-of select="@uname"/>&amp;redirect=/MD-PIVOT.jsp</xsl:attribute>
      <xsl:value-of select="@caption"/>
    </a>
    </div>
  </th>
</xsl:template>


<xsl:template match="cell">
  <td nowrap="nowrap" class="cell-{@style}" align="right">
    <xsl:value-of select="@value"/>
  </td>
</xsl:template>

<xsl:template match="*|@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="*|@*|node()"/>
  </xsl:copy>
</xsl:template>

</xsl:stylesheet>