![]() |
ADOS Developer's Site - XML Stadium |
![]() |
![]() |
|
![]() |
【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変換処理を記述する。 |
Copyright 2005-2008. ADOS Co., Ltd. All Rights Reserved. |