Endnoteの分解

は複数のを格納している。これらを個別に評価して、特定の名前のみをハンドルする(下記の例では、"Hogeyama, H."さんのみを を用いてボールド体にしている)

<?xml version="1.0" encoding="Shift_jis"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
    <body>
      <xsl:apply-templates/>
    </body>
  </html>
</xsl:template>
<xsl:template match="Article">
  <xsl:apply-templates select="title"/>
  <xsl:apply-templates select="tbl"/>
</xsl:template>
<xsl:template match="title">
  <h3><xsl:value-of select="."/></h3>
</xsl:template>
<xsl:template match="tbl">
  <table border="3">
    <tr>
      <th>Year</th>
      <th>Title</th>
      <th>Journal</th>
      <th>Volume</th>
      <th>Number</th>
      <th>Pages</th>
      <th>Authors</th>
    </tr>
    <xsl:variable name="t" select="document(@href)"/>
    <xsl:for-each select="$t//RECORD">
      <tr>
        <td><xsl:value-of select="YEAR"/></td>
        <td><a><xsl:attribute name="href"><xsl:value-of select="URL"/></xsl:attribute><xsl:value-of select="TITLE"/></a></td>
        <td><xsl:value-of select="SECONDARY_TITLE"/></td>
        <td><xsl:value-of select="VOLUME"/></td>
        <td><xsl:value-of select="NUMBER"/></td>
        <td><xsl:value-of select="PAGES"/></td>
        <td>
        <xsl:for-each select="AUTHORS//AUTHOR">
         <xsl:choose>
          <xsl:when test=".='Hogeyama, H.'">
           <b><xsl:value-of select="."/>,</b>
          </xsl:when>
          <xsl:otherwise>
           <xsl:value-of select="."/>,
          </xsl:otherwise>
         </xsl:choose>
        </xsl:for-each>
        </td>
      </tr>
    </xsl:for-each>
  </table>
</xsl:template>
</xsl:stylesheet>

簡単に論文リストのウェブ表示

Endnoteなどのレファレンスマネージャソフトはエクスポート昨日により、XML形式のファイルが簡単に作れる。この書式に対応したXSLファイルを作ることで、簡単に管理論文のブラウザ表示をすることができる。
実例はこちら

  • 上記サイトの表示は、次の3ファイルを同一ディレクトリに置いてアクセス。
  • 作成方法
    • Endnoteのツールバー"File"から、Exportへ進み、保存にあたって、ファイルの種類をXML指定する。"fromEndnote.xml"という名前で保存したとする。
    • "Article.xml"というブラウザに読ませるファイルを次のように作る。
<?xml version="1.0" encoding="Shift_JIS" ?>
<?xml:stylesheet type="text/xsl" href="Article.xsl"?>
<Article>
<title>Article</title>
<tbl href="fromEndnote.xml"/>
</Article>
<?xml version="1.0" encoding="Shift_jis"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
    <body>
      <xsl:apply-templates/>
    </body>
  </html>
</xsl:template>
<xsl:template match="Article">
  <xsl:apply-templates select="title"/>
  <xsl:apply-templates select="tbl"/>
</xsl:template>
<xsl:template match="title">
  <h3><xsl:value-of select="."/></h3>
</xsl:template>
<xsl:template match="tbl">
  <table border="3">
    <tr>
      <th>Year</th>
      <th>Title</th>
      <th>Journal</th>
      <th>Volume</th>
      <th>Number</th>
      <th>Pages</th>
      <th>Authors</th>
    </tr>
    <xsl:variable name="t" select="document(@href)"/>
    <xsl:for-each select="$t//RECORD">
      <tr>
        <td><xsl:value-of select="YEAR"/></td>
        <td><a><xsl:attribute name="href"><xsl:value-of select="URL"/></xsl:attribute><xsl:value-of select="TITLE"/></a></td>
        <td><xsl:value-of select="SECONDARY_TITLE"/></td>
        <td><xsl:value-of select="VOLUME"/></td>
        <td><xsl:value-of select="NUMBER"/></td>
        <td><xsl:value-of select="PAGES"/></td>
        <td><xsl:value-of select="AUTHORS"/></td>
      </tr>
    </xsl:for-each>
  </table>
</xsl:template>
</xsl:stylesheet>