books1.xsl
最終更新:2009/11/21
001: <?xml version="1.0" encoding="UTF-8"?> 002: 003: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 004: <xsl:output method="html" encoding="Shift_JIS"/> 005: 006: <!-- 007: <xsl:output method="xml" encoding="UTF-8"/> 008: --> 009: <xsl:template match="/Workbook"> 010: <xsl:variable name="title" select="DocumentProperties/Title"/> 011: <xsl:variable name="name_isbn10" select="Worksheet[1]/Table/Row[1]/Cell[1]/Data"/> 012: <xsl:variable name="name_isbn13" select="Worksheet[1]/Table/Row[1]/Cell[2]/Data"/> 013: <xsl:variable name="name_title" select="Worksheet[1]/Table/Row[1]/Cell[3]/Data"/> 014: <xsl:variable name="name_author" select="Worksheet[1]/Table/Row[1]/Cell[4]/Data"/> 015: <xsl:variable name="name_pub_date" select="Worksheet[1]/Table/Row[1]/Cell[5]/Data"/> 016: <xsl:variable name="name_publisher" select="Worksheet[1]/Table/Row[1]/Cell[6]/Data"/> 017: <xsl:variable name="num" select="count(Worksheet[1]/Table/Row[position()>1])"/> 018: 019: <html> 020: <head> 021: <!-- 022: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 023: --> 024: <title><xsl:value-of select="$title"/> (<xsl:value-of select="$num"/>)</title> 025: </head> 026: <body> 027: <p><b><xsl:value-of select="$title"/>(<xsl:value-of select="$num"/> 冊)</b></p> 028: <p><table border="1" cellpadding="2" cellspacing="0"><tr> 029: <td bgcolor="skyblue" align="center" nowrap="nowrap"><xsl:value-of select="$name_isbn10"/></td> 030: <td bgcolor="skyblue" align="center" nowrap="nowrap"><xsl:value-of select="$name_isbn13"/></td> 031: <td bgcolor="skyblue" align="center" nowrap="nowrap"><xsl:value-of select="$name_title"/></td> 032: <td bgcolor="skyblue" align="center" nowrap="nowrap"><xsl:value-of select="$name_author"/></td> 033: <td bgcolor="skyblue" align="center" nowrap="nowrap"><xsl:value-of select="$name_pub_date"/></td> 034: <td bgcolor="skyblue" align="center" nowrap="nowrap"><xsl:value-of select="$name_publisher"/></td> 035: </tr> 036: <xsl:apply-templates select="Worksheet[1]/Table/Row[position()>1]"> 037: <xsl:sort select="Cell[5]/Data"/> 038: </xsl:apply-templates> 039: </table></p> 040: </body> 041: </html> 042: </xsl:template> 043: 044: <xsl:template match="Row"> 045: <xsl:if test="count(Cell)=6"><!-- 項目が足りない行は泣く泣く割愛する --> 046: <tr valign="top"> 047: <td><xsl:value-of select="Cell[1]/Data"/></td> 048: <td><xsl:value-of select="Cell[2]/Data"/></td> 049: <td><xsl:value-of select="Cell[3]/Data"/></td> 050: <td><xsl:value-of select="Cell[4]/Data"/></td> 051: <td><xsl:value-of select="Cell[5]/Data"/></td> 052: <td><xsl:value-of select="Cell[6]/Data"/></td> 053: </tr> 054: </xsl:if> 055: </xsl:template> 056: 057: </xsl:stylesheet>
![]() | KAKU PROJECT (2009) |