<?xml version="1.0" encoding="shift_jis"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> <xsl:strip-space elements="*" /> <xsl:output method="text" encoding="shift-jis" indent="no" media-type="text/xml" /> <xsl:template match="/"> <!--ドキュメントクラス宣言 --> documentclass[<xsl:value-of select="root/@option" />]{<xsl:value-of select="root/@class" />} <!--プレアンブル--> <xsl:value-of select="root/head/pack" /> parindent=0pt title{<xsl:apply-templates select="/root/head/title" />} author{<xsl:value-of select="/root/head/author" />} date{<xsl:value-of select="/root/head/date" />} <!-- 終わり--> <!--ドキュメントの始まり--> begin{document} <xsl:apply-templates select="root/body/*" /> end{document} <!--タイトルと目次 --> <xsl:template match="maketitle"> maketitle thispagestyle{empty} <!-- 目次 --> <xsl:template match="toc"> pagenumbering{roman} setcounter{page}{1} tableofcontents newpage pagenumbering{arabic} setcounter{page}{1}
<!-- 見出し関連 --> <!--セクション--> <xsl:template match="section"> section{<xsl:value-of select="@title" />} <!--サブセクション--> <xsl:template match="subsection"> subsection{<xsl:value-of select="@title" />} <!--サブサブセクション--> <xsl:template match="subsubsection"> subsubsection{<xsl:value-of select="@title" />} <!-- 文字関連 --> <!-- 文字寄せ--> <xsl:template match="center"> begin{center} end{center} <!-- 右寄せ --> <xsl:template match="right"> begin{flushright} end{flushright}
<!-- 左寄せ --> <xsl:template match="left"> begin{flushleft} end{flushleft} <!-- 太文字 --> <xsl:template match="b"> textbf{} <!--イタリック--> <xsl:template match="i"> textit{} <!-- 下線 --> <xsl:template match="u"> Underline{} <!-- 文字サイズ --> <!-- 大きくする--> <xsl:template match="large"> { large } <xsl:template match="large"> { Large } <xsl:template match="large"> { LARGE } <!-- 小さくする --> <xsl:template match="tiny">
{ tiny } <xsl:template match="small"> { small } <!-- 段落 --> <xsl:template match="p"> par{} <!-- 改行 --> <xsl:template match="br"> {} <!-- 箇条書き --> <!-- 番号付き箇条書き--> <xsl:template match="ol"> begin{enumerate} end{enumerate} <!-- 番号なし箇条書き--> <xsl:template match="ul"> begin{itemize} end{itemize} <!-- リストアイテム --> <xsl:template match="li"> item <!-- 表 --> <!--テーブル--> <xsl:template match="table"> <!-- 中央なら --> <xsl:when test="contains(@align,'center')">
begin{center} <!-- 右寄せなら --> <xsl:when test="contains(@align,'right')"> begin{flushright} <!-- 左寄せなら --> <xsl:when test="contains(@align,'left')"> begin{flushleft} begin{flushleft} <!-- tabular の始まり --> begin{tabular}{<xsl:value-of select="@sell" />} <!--hline--> <xsl:for-each select="tr"> <!-- <tr> が最後なら --> <xsl:when test="position()=last()"> hline <!--td の分岐 --> <xsl:for-each select="td"> <xsl:when test="position()=last()"> & </xsl:for-each> hline
hline <xsl:for-each select="td"> <xsl:when test="position()=last()"> & </xsl:for-each> </xsl:for-each> end{tabular} <!-- end の出力 --> <!-- 中央なら --> <xsl:when test="contains(@align,'center')"> end{center} <!-- 右寄せなら --> <xsl:when test="contains(@align,'right')"> end{flushright} <!-- 左寄せなら --> <xsl:when test="contains(@align,'left')"> end{flushleft} end{flushleft}
<!-- 特殊文字 --> <!-- 大なり--> <xsl:template match="lt">$<${} <!-- 小なり--> <xsl:template match="gt">$>${} <!--ドル--> <xsl:template match="dol"> ${} <!-- アンダーバー --> <xsl:template match="ub"> _{} <!-- アンド --> <xsl:template match="and"> &{} <!-- 円マーク --> <xsl:template match="yen"> textbackslash{} <!-- 中括弧 --> <xsl:template match="rk"> {{} <xsl:template match="lk"> }{} <!--ニューページ--> <xsl:template match="newpage"> newpage <!-- 引用 --> <xsl:template match="bq"> begin{quotation} end{quotation} <!-- TeX と LaTeX --> <xsl:template match="tex"> TeX{} <xsl:template match="latex"> LaTeX{} <xsl:template match="latexe"> LaTeXe{} <!-- pre タグ --> <xsl:template match="pre"> begin{verbatim}<xsl:value-of select="." /> end{verbatim}
<!-- 後注 --> <xsl:template match="footnote"> footnote{} <xsl:template match="outnote"> 後注 <!-- 文献表 --> <xsl:template match="biblio"> <xsl:when test="@title"> <xsl:value-of select="@title" /> 参考文献 begin{itemize} end{itemize} </xsl:stylesheet>