XSLT を使用して XML ドキュメントを HTML に変換しようとしています。
ドキュメントは外部のものであり、完全には文書化されていません。そのために、私はいくつかのノードしか知りません (したがって、処理します)。
新しいノードが追加される場合があります。
最初に不明な子ノードがあるかどうかを判断し、ある場合は単純に HTML テーブルに表示します。派手なものはありません。
私の現在のxsltスニペットは...
<xsl:if test="*[not(service or searchtext or clientreference or threshold or resultcount or results or options or error)]">
<div class="requestSupportData">
<table class="zebra">
<caption>Request supportive data</caption>
<thead>
<tr>
<th>Element</th>
<th>Value</th>
</tr>
</thead>
<tfoot>
<tr>
<th colspan="2">
<a href="#top">Top</a>
</th>
</tr>
</tfoot>
<tbody>
<xsl:for-each select="*[not(service or searchtext or clientreference or threshold or resultcount or results or options or error)]">
<tr>
<th>
<xsl:value-of select="local-name(.)"/>
</th>
<td>
<xsl:value-of select="."/>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</div>
ここで達成しようとしているのは、サービス、検索テキストなどと呼ばれていないノードがあることです。そのため、それらを HTML テーブルの単純な名前/値のペアとしてレンダリングします。
不要な要素を含め、何も取得していないか、すべてを取得しています。
よろしく、
リチャード。