デフォルトXSLTファイルのカスタマイズ

デフォルトのXSL変換ファイル(wx=default.xsltで参照されるファイル)はカスタマイズが可能です。この項では、カスタマイズの例を紹介します。

次の例では、変数バインディングがhttp://purl.org/goodrelations/v1#で始まるURIを返す場合にはその部分がgr:;によって置き換えられ、変数バインディングがhttp://www.w3.org/2000/01/rdf-schema#で始まるURIを返す場合にはその部分がrdfs:によって置き換えられる、というネームスペース接頭辞置換ロジックを実装しています。

<xsl:when test="starts-with(text(),
'http://purl.org/goodrelations/v1#')">
<xsl:value-of select="concat('gr:',substring-after(text(),
'http://purl.org/goodrelations/v1#'))"/>
</xsl:when>
...
<xsl:when test="starts-with(text(),
                         'http://www.w3.org/2000/01/rdf-schema#')">
   <xsl:value-of select="concat('rdfs:',substring-after(text(),
'http://www.w3.org/2000/01/rdf-schema#'))"/>
</xsl:when>
The following example implements logic to trim a leading http://localhost/ 
or a leading http://127.0.0.1/.
<xsl:when test="starts-with(text(),'http://localhost/')">
  <xsl:value-of select="substring-after(text(),'http://localhost/')"/>
</xsl:when>
<xsl:when test="starts-with(text(),'http://127.0.0.1/')">
  <xsl:value-of select="substring-after(text(),'http://127.0.0.1/')"/>
</xsl:when>