[ADOS] ADOS Developer's Site - XML Stadium
ADOS Company slogan - XML Total Solution

【Relaxerを利用したXSLTファイルの雛形作成】

1. XMLファイル(XMLインスタンス)を用意する。

国.xml

<?xml version="1.0"?>
<table xmlns="urn:test:1.1">
	<row>
		<col1>日本</col1>
		<col2>Japan</col2>
		<col3>東京</col3>
	</row>
	<row>
		<col1>フランス</col1>
		<col2>France</col2>
		<col3>パリ</col3>
	</row>
</table>

2. コマンドプロンプトで、Relaxer を使用して .xsl ファイルを作成する。

relaxer -xslt 国.xml

3. XSLT変換のための .xsl ファイルの雛形が、カレントディレクトリに作成される。

国.xsl

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output indent="yes" method="xml"/>
 <xsl:template match="col2">
   <col2>
     <xsl:apply-templates/>
   </col2>
 </xsl:template>
 <xsl:template match="col3">
   <col3>
     <xsl:apply-templates/>
   </col3>
 </xsl:template>
 <xsl:template match="col1">
   <col1>
     <xsl:apply-templates/>
   </col1>
 </xsl:template>
 <xsl:template match="row[col1 and col2 and col3]">
   <row>
     <xsl:apply-templates/>
   </row>
 </xsl:template>
 <xsl:template match="table[row]">
   <table>
     <xsl:apply-templates/>
   </table>
 </xsl:template>
</xsl:stylesheet>

4. 雛形の .xsl ファイルを基に編集し、目的とするXSLT変換処理を記述する。


トップ   差分 バックアップ リロード   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: Sat, 26 Jul 2008 13:14:23 JST (5746d)

Copyright 2005-2008. ADOS Co., Ltd. All Rights Reserved.