OSDN Git Service

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@1020 1ca29b6e-896d...
[nucleus-jp/nucleus-plugins.git] / NP_TrackBack / branches / DOM-branch / trackback / js / rico / ricoSimpleGrid2xl.xsl
diff --git a/NP_TrackBack/branches/DOM-branch/trackback/js/rico/ricoSimpleGrid2xl.xsl b/NP_TrackBack/branches/DOM-branch/trackback/js/rico/ricoSimpleGrid2xl.xsl
new file mode 100644 (file)
index 0000000..f04b2e1
--- /dev/null
@@ -0,0 +1,160 @@
+<xsl:stylesheet version="1.0"\r
+  xmlns="urn:schemas-microsoft-com:office:spreadsheet"\r
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"\r
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \r
+       xmlns:msxsl="urn:schemas-microsoft-com:xslt"\r
+       xmlns:o="urn:schemas-microsoft-com:office:office"\r
+       xmlns:x="urn:schemas-microsoft-com:office:excel"\r
+  xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">\r
+\r
+<xsl:output method="xml" indent="yes" omit-xml-declaration="no" media-type="application/xml"/>\r
+\r
+<xsl:template match="/">\r
+  <xsl:processing-instruction name="mso-application">\r
+  <xsl:text>progid="Excel.Sheet"</xsl:text> \r
+  </xsl:processing-instruction>\r
+\r
+  <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\r
+   xmlns:o="urn:schemas-microsoft-com:office:office"\r
+   xmlns:x="urn:schemas-microsoft-com:office:excel"\r
+   xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\r
+   xmlns:html="http://www.w3.org/TR/REC-html40">\r
+\r
+ <Styles>\r
+  <Style ss:ID="Default" ss:Name="Normal">\r
+   <Alignment ss:Vertical="Bottom"/>\r
+   <Borders/>\r
+   <Font/>\r
+   <Interior/>\r
+   <NumberFormat/>\r
+   <Protection/>\r
+  </Style>\r
+  <Style ss:ID="s21">\r
+   <Font ss:Bold="1"/>\r
+   <Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>\r
+  </Style>\r
+  <Style ss:ID="s22">\r
+   <Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/>\r
+   <Font ss:Bold="1"/>\r
+   <Interior ss:Color="#99CCFF" ss:Pattern="Solid"/>\r
+  </Style>\r
+  <Style ss:ID="s23" ss:Name="Currency">\r
+   <NumberFormat\r
+    ss:Format="_(&quot;$&quot;* #,##0.00_);_(&quot;$&quot;* \(#,##0.00\);_(&quot;$&quot;* &quot;-&quot;??_);_(@_)"/>\r
+  </Style>\r
+  <Style ss:ID="s24">\r
+   <NumberFormat ss:Format="_(* #,##0.00_);_(* \(#,##0.00\);_(* &quot;-&quot;??_);_(@_)"/>\r
+  </Style>\r
+  <Style ss:ID="s25">\r
+   <Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>\r
+  </Style>\r
+ </Styles>\r
+\r
+  <xsl:apply-templates mode="top"/> \r
+\r
+  </Workbook>\r
+</xsl:template>\r
+\r
+\r
+<xsl:template match="*" mode="top">\r
+  <xsl:choose>\r
+\r
+  <xsl:when test="xhtml:table[@class='ricoSimpleGrid']">\r
+  <xsl:apply-templates mode="grid"/> \r
+  </xsl:when>\r
+\r
+  <xsl:otherwise>\r
+  <xsl:apply-templates select="*" mode="top"/> \r
+  </xsl:otherwise>\r
+  \r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+\r
+<xsl:template match="*" mode="grid">\r
+\r
+  <xsl:choose>\r
+  \r
+  <xsl:when test="xhtml:thead">\r
+  <xsl:call-template name="processTable">\r
+  <xsl:with-param name="id" select="@id"/>\r
+  <xsl:with-param name="headRows" select="xhtml:thead/xhtml:tr"/>\r
+  <xsl:with-param name="bodyRows" select="xhtml:tbody/xhtml:tr"/>\r
+  </xsl:call-template>\r
+  </xsl:when>\r
+  \r
+  <xsl:when test="xhtml:tbody">\r
+  <xsl:call-template name="processTable">\r
+  <xsl:with-param name="id" select="@id"/>\r
+  <xsl:with-param name="headRows" select="xhtml:tbody/xhtml:tr[1]"/>\r
+  <xsl:with-param name="bodyRows" select="xhtml:tbody/xhtml:tr[position() &gt; 1]"/>\r
+  </xsl:call-template>\r
+  </xsl:when>\r
+  \r
+  <xsl:otherwise>\r
+  <xsl:call-template name="processTable">\r
+  <xsl:with-param name="id" select="@id"/>\r
+  <xsl:with-param name="headRows" select="xhtml:tr[1]"/>\r
+  <xsl:with-param name="bodyRows" select="xhtml:tr[position() &gt; 1]"/>\r
+  </xsl:call-template>\r
+  </xsl:otherwise>\r
+  \r
+  </xsl:choose>\r
+\r
+</xsl:template>\r
+\r
+\r
+<!-- Perform the actual table transformation -->\r
+  \r
+<xsl:template name="processTable">\r
+<xsl:param name="id" />\r
+<xsl:param name="headRows" />\r
+<xsl:param name="bodyRows" />\r
+\r
+ <Worksheet>\r
+ <xsl:attribute name="ss:Name">\r
+   <xsl:value-of select='$id'/>\r
+ </xsl:attribute>\r
+  <Table>\r
+\r
+  <xsl:apply-templates select="$headRows" mode="convertHeadRow"/>\r
+  <xsl:apply-templates select="$bodyRows" mode="convertBodyRow"/>\r
+\r
+  </Table>\r
+ </Worksheet>\r
+\r
+</xsl:template>\r
+\r
+\r
+<xsl:template match="*" mode="convertHeadRow">\r
+   <Row>\r
+    <xsl:apply-templates select="xhtml:td | xhtml:th" mode="convertHeadCell"/>\r
+   </Row>\r
+</xsl:template>\r
+\r
+\r
+<xsl:template match="*" mode="convertHeadCell">\r
+  <xsl:element name="Cell">\r
+  <xsl:attribute name="ss:StyleID">s22</xsl:attribute>\r
+  <xsl:if test="@colspan">\r
+  <xsl:attribute name="ss:MergeAcross"><xsl:value-of select="number(@colspan)-1"/></xsl:attribute>\r
+  </xsl:if>\r
+    <Data ss:Type="String">\r
+    <xsl:value-of select="."/>\r
+    </Data>\r
+  </xsl:element>\r
+</xsl:template>\r
+\r
+\r
+<xsl:template match="*" mode="convertBodyRow">\r
+   <Row>\r
+    <xsl:apply-templates select="xhtml:td | xhtml:th" mode="convertBodyCell"/>\r
+   </Row>\r
+</xsl:template>\r
+\r
+\r
+<xsl:template match="*" mode="convertBodyCell">\r
+    <Cell><Data ss:Type="String"><xsl:value-of select="."/></Data></Cell>\r
+</xsl:template>\r
+\r
+</xsl:stylesheet>
\ No newline at end of file