Skip to content

Instantly share code, notes, and snippets.

@showwin
Last active March 31, 2020 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save showwin/8922875c6d7a29fdda3a7af9b65f9268 to your computer and use it in GitHub Desktop.
Save showwin/8922875c6d7a29fdda3a7af9b65f9268 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://sqlfairy.sourceforge.net/sqlfairy.xml">
<xsl:output method="html" encoding="utf8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
<xsl:template match="database">
<html lang="ja">
<head>
<meta charset="utf-8"/>
<title>テーブル定義</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>
<style>
html body {
font-family: sans-serif !important;;
}
table.htable {
margin: 3em auto 1em auto !important;
}
table.htable th {
border-left: 10px solid #e5e5e5 !important;
}
footer {
border-top: 1px solid #e5e5e5;
padding: 0.5em;
}
</style>
</head>
<body>
<div class="container">
<h1 class="page-header">テーブル定義</h1>
<xsl:apply-templates select="table_structure"/>
</div>
<footer class="text-center">
Created by showwin.
</footer>
</body>
</html>
</xsl:template>
<xsl:template match="table_structure">
<table class="table table-bordered htable">
<tbody>
<tr class="active">
<th>テーブル名</th>
<td><xsl:value-of select="@name"/></td>
<td><xsl:apply-templates select="options"/></td>
</tr>
</tbody>
</table>
<table class="table table-condensed">
<thead>
<tr>
<th class="text-right">#</th>
<th>物理名</th>
<th>論理名</th>
<th>型</th>
<th>NULL</th>
<th>デフォルト値</th>
<th>主キー</th>
<th>ユニーク</th>
<th>その他</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="field"/>
</tbody>
</table>
</xsl:template>
<xsl:template match="field">
<tr>
<td class="text-right"><xsl:value-of select="position()"/></td>
<td><xsl:value-of select="@Field"/></td>
<td><xsl:value-of select="@Comment"/></td>
<td><xsl:value-of select="@Type"/></td>
<td><xsl:if test="@Null='YES'"><span class="glyphicon glyphicon-ok"></span></xsl:if></td>
<td><xsl:value-of select="@Default"/></td>
<td><xsl:if test="@Key='PRI'"><span class="glyphicon glyphicon-ok"></span></xsl:if></td>
<td><xsl:if test="@Key='UNI'"><span class="glyphicon glyphicon-ok"></span></xsl:if></td>
<td><xsl:value-of select="@Extra"/></td>
</tr>
</xsl:template>
<xsl:template match="options">
<xsl:value-of select="@Comment"/>
</xsl:template>
</xsl:stylesheet>
@x-blood
Copy link

x-blood commented Mar 31, 2020

MMMのx-bloodです。こちら再利用させて頂きました。
ありがとうございます。 🙇‍♂️

@showwin
Copy link
Author

showwin commented Mar 31, 2020

@x-blood
もうこれがなんだったのかすら覚えてませんが…笑
お役に立てたのであればよかったです!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment