以下の操作により、コンテンツ切り出し定義を追加し、関連付けの定義を行うことができます。ただし、ここで作成した関連付けの定義は、休止中の状態で追加されます。
操作
[コンテンツカスタマイズ関連付け管理]画面の[関連付けの作成]ボタンをクリックします。
⇒[関連付け定義の新規作成]画面が表示されます。
[説明]、[URLパターン]、および[XSLスタイルシート]を指定します。ただし、XSLスタイルシートの文法チェックは行いませんので、事前に文法の誤りがないことを確認しておく必要があります。このため、コンテンツ切り出しツールで生成したXSLスタイルシートのソースや“12.3.5 XSLスタイルシート内容の表示”で表示したXSLスタイルシートのソースから、カット&ペーストし、Shift_JIS文字コードに変換した内容を用いることを推奨します。
[保存]ボタンをクリックします。
⇒定義したコンテンツ切り出し定義とその関連付け定義が、休止中状態で保存され、[コンテンツカスタマイズ関連付け管理]画面が再表示されます。
[戻る]ボタンをクリックすると、内容を保存せずに[コンテンツカスタマイズ関連付け管理]画面が再表示されます。
次のXSLスタイルシートは、HTML中の<a>タグを<b>タグに変換するサンプルです。 <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" /> <!-- create tags for the document root --> <xsl:template match="/"> <html> <xsl:apply-templates /> </html> </xsl:template> <!-- Include this node and all descendant nodes and text unless otherwise excluded --> <xsl:template match="/html[1]/head[1] |/html[1]/head[1]//* |/html[1]/head[1]//text() |/html[1]/noframe[1] |/html[1]/noframe[1]//* |/html[1]/noframe[1]//text() |/html[1]/frameset[1] |/html[1]/frameset[1]//* |/html[1]/frameset[1]//text() |/html[1]/body[1] |/html[1]/body[1]//* |/html[1]/body[1]//text()"> <xsl:call-template name="passthru" /> </xsl:template> <!-- template to translate 'a' tag to 'b' tag --> <xsl:template match="a |a//* |a//text()" priority="1"> <xsl:element name="b"> <xsl:copy-of select="node()" /> </xsl:element> </xsl:template> <!-- default text template --> <xsl:template priority="0" match="text()" /> <!-- template to duplicate the current node and apply templates --> <xsl:template name="passthru"> <xsl:choose> <xsl:when test="name()"> <xsl:element name="{name()}"> <xsl:for-each select="@*"> <xsl:attribute name="{name()}"> <xsl:value-of select="."/> </xsl:attribute> </xsl:for-each> <xsl:apply-templates /> </xsl:element> </xsl:when> <xsl:otherwise> <xsl:value-of select="."/> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> |
|