<xvcd:if>の練習4 属性の値を調べて表示方法を分ける

<xvcd:if>の使い方の例。<m3:person>タグのpost属性が"取締役"かそうでないかで色と表示する文字を変えている。
属性を@で指定する方法、および = と != の使い方に注意。条件を指定しているのは次の記述。

		<xvcd:if test="@post='取締役'">
		<xvcd:if test="@post!='取締役'">


【result view】

【xfy_sample0019.xml】
<?xml version="1.0"?>
<?com.xfy vocabulary-connection href="xfy_sample0019.xvcd" ?>
<m3:document xmlns:m3="http://www.makoto3.net/xfy">
	<m3:list>
		<m3:person num="001" sex="男" age="58" post="社長">山田太郎</m3:person>
		<m3:person num="002" sex="男" age="42" post="取締役">鈴木健一</m3:person>
		<m3:person num="003" sex="女" age="48" post="取締役">菊池桃子</m3:person>
		<m3:person num="004" sex="男" age="39" post="部長">吉田啓介</m3:person>
		<m3:person num="005" sex="女" age="38" post="部長">三好恵美子</m3:person>
		<m3:person num="006" sex="男" age="25" post="">神田紀夫</m3:person>
		<m3:person num="007" sex="男" age="30" post="">菊野浩二</m3:person>
		<m3:person num="008" sex="女" age="28" post="">美濃励子</m3:person>
		<m3:person num="009" sex="男" age="22" post="">岡野祐輔</m3:person>
		<m3:person num="010" sex="男" age="35" post="">和田真一</m3:person>
	</m3:list>
</m3:document>

【xfy_sample0019.xvcd】
<?xml version="1.0"?>

<xvcd:xvcd
	xmlns:xvcd="http://xmlns.xfy.com/xvcd"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:m3="http://www.makoto3.net/xfy"
	version="1.0">

<xvcd:vocabulary name="xfy_sample" match="m3:document" call-template="root"/>
	<xvcd:template name="root">
		<html>
			<head>
				<title>xfy example</title>
			</head>
			<body>
					<xvcd:apply-templates select="m3:list/m3:person"/>
			</body>
		</html>
	</xvcd:template>
	<xvcd:template match="m3:list/m3:person">
		<xvcd:if test="@post='取締役'">
			<span style="color:red">
			<xvcd:value-of select="."/>
			</span>さんは取締役だよ~ん。<br/>
		</xvcd:if>
		<xvcd:if test="@post!='取締役'">
			<span style="color:blue">
			<xvcd:value-of select="."/>
			</span>さんは取締役じゃないよーん。<br/>
		</xvcd:if>
	</xvcd:template>
</xvcd:xvcd>