| [Home] [Kuri] [Sysad] [Internet?] [Blog] [Java] [Windows] [Download] [Profile] [Flash] [+] |
<!ELEMENT releaseMemo (machine,version,problem+,correction+,releaseDate)> <!ELEMENT machine (#PCDATA)> <!ELEMENT version (#PCDATA)> <!ELEMENT problem (#PCDATA)> <!ATTLIST problem index #IMPLIED> <!ELEMENT correction (#PCDATA)> <!ATTLIST correction index #IMPLIED> <!ELEMENT releaseDate (#PCDATA)> |
<?xml version="1.0"?>
<releaseMemo>
<machine> Machine-1 </machine>
<version> 1.1 </version>
<problem index="a."> シュート成功率が悪い。</problem>
<problem index="b."> すぐにばてる。</problem>
<correction index="a."> 眼鏡の度を修正。</correction>
<correction index="b."> メモリリークを修正。</correction>
<correction index="c."> フックシュートに対応。</correction>
<releaseDate>2001年5月30日</releaseDate>
</releaseMemo>
|
\documentstyle[a4j]{jarticle}
\pagestyle{empty}
\begin{document}
\begin{center}
{\large リリースメモ}
\end{center}
\begin{tabular}{p{4cm}p{11cm}}
機種名: & machine \\
バージョン: & version \\
問題点: \\
& problem の index と problem \\
& problem の index と problem \\
:
:
修正内容:\\
& correction の index と correction \\
& correction の index と correction \\
:
:
リリース日: & releaseDate \\
\end{tabular}
\end{document}
|
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" encoding="EUC-JP"/>
<xsl:template match="releaseMemo">
\documentstyle[a4j]{jarticle}
\pagestyle{empty}
\begin{document}
\begin{center}
{\large リリースメモ}
\end{center}
\begin{tabular}{p{4cm}p{11cm}}
機種名: & <xsl:value-of select="machine"/> \\
バージョン: & <xsl:value-of select="version"/> \\
問題点: \\
<xsl:apply-templates select="problem"/>
修正内容:\\
<xsl:apply-templates select="correction"/>
リリース日: & <xsl:value-of select="releaseDate"/> \\
\end{tabular}
\end{document}
</xsl:template>
<xsl:template match="problem">
& <xsl:value-of select="attribute::index/>
<xsl:value-of select="."/> \\
</xsl:template>
<xsl:template match="correction">
& <xsl:value-of select="attribute::index/>
<xsl:value-of select="."/> \\
</xsl:template>
</xsl:stylesheet>
|
import org.apache.xalan.xslt.*;
import org.xml.sax.*;
public class doctrans {
public static void main(String[] a) {
if(a.length != 2) {
System.err.println("Usage: java doctrans XML XSL");
System.exit(1);
}
try {
XSLTProcessor proc = XSLTProcessorFactory.getProcessor();
proc.process(new XSLTInputSource(a[0]),
new XSLTInputSource(a[1]),
new XSLTResultTarget(System.out));
} catch(Exception e) {
e.printStackTrace();
}
}
}
|
% java doctrans test1.xml temp1.xml file:///some/where/test/test1.xml; Line 11; Column 14 XSL Error: Could not parse test1.xml document! XSL Error: SAX Exception ...後略 |
% java enctrans test1.xml JISAutoDetect UTF8 > test1.xml.utf8
% java enctrans temp1.xml JISAutoDetect UTF8 > temp1.xml.utf8
% java doctrans test1.xml.utf8 temp1.xml.utf8
\documentstyle[a4j]{jarticle}
\pagestyle{empty}
\begin{document}
\begin{center}
{\large リリースメモ}\\
\end{center}
\begin{tabular}{p{4cm}p{11cm}}
機種名: & Machine-1 \\
バージョン: & 1.1 \\
問題点: \\
& a. シュート成功率が悪い。 \\
& b. すぐにばてる。 \\
修正内容: \\
& a. 眼鏡の度を修正。 \\
& b. メモリリークを修正。 \\
& c. フックシュートに対応。 \\
リリース日: & 2001年5月30日 \\
\end{tabular}
\end{document}
|
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" encoding="SJIS"/>
<xsl:template match="releaseMemo">
<html>
<head>
<title>Release Memo</title>
<meta http-equiv="Content-Type" content="text/html; charset=x-sjis"/>
</head>
<body>
<h1>リリースメモ</h1>
<table>
<tr><th align="left">機種名:</th>
<td><xsl:value-of select="machine"/></td>
</tr>
<tr><th align="left">バージョン</th>
<td><xsl:value-of select="version"/></td>
</tr>
<tr><th align="left">問題点:</th>
</tr>
<xsl:apply-templates select="problem"/>
<tr><th align="left">修正内容:</th>
</tr>
<xsl:apply-templates select="correction"/>
<tr><th align="left">リリース日:</th>
<td><xsl:value-of select="releaseDate"/></td>
</tr>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="problem">
<tr><td></td>
<td><xsl:value-of select="attribute::index"/>
<xsl:value-of select="."/></td>
</tr>
</xsl:template>
<xsl:template match="correction">
<tr><td></td>
<td><xsl:value-of select="attribute::index"/>
<xsl:value-of select="."/></td>
</tr>
</xsl:template>
</xsl:stylesheet>
|
|
|
| [Home] [Kuri] [Sysad] [Internet?] [Blog] [Java] [Windows] [Download] [Profile] [Flash] [-] | |
| usu@usupi.org | Last modified : Wed Jun 6 14:37:44 2001 |