XML/XSLのTIPS集
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
// 下階層用テンプレート
#topicpath
----
//ここにコンテンツを記述します。
***XMLファイルに、XSLスタイルシートを関連づけ。 [#w653b501]
<?xml-stylesheet type="text/xsl" href="midashi.xsl" ?>
***アンカーをつける [#r50b5f3c]
<a><xsl:attribute name="name">code-<xsl:value-of select=...
とすると、
<a name="code-6758" />
となる(6758はcode要素の値)。
***アンカーへのリンクを張る [#qff645a3]
<a><xsl:attribute name="href">#code-<xsl:value-of select...
とすると
<a href="#code-6758">6758</a>
となる。
***繰り返し処理で、最後以外にカンマをつける [#md326f06]
よくある処理なので、まとめておきます。
<xsl:template match="security">
<xsl:apply-templates select="attribute" />
<xsl:choose>
<xsl:when test="position()=last()" />
<xsl:otherwise>,</xsl:otherwise>
</xsl:choose>
</xsl:template>
***○○属性が存在するときのみ、表示する [#x728cc9a]
<xsl:if test="count(@name)!=0">属性[<xsl:apply-templates...
***modeの使い方 [#f45edb86]
XSLTの仕様にmodeという仕様があります。同じ要素名に対して...
<xsl:template match="security">
一覧:<xsl:apply-templates select="code" />
</xsl:template>
<xsl:template match="security" mode="detail">
詳細:<xsl:apply-templates select="code" />
</xsl:template>
と定義しておいて
一覧を表示したいところに <xsl:apply-templates select="se...
詳細を表示したいところに <xsl:apply-templates select="se...
***xslでスペース( )を入れたい [#o824c060]
<xsl:text disable-output-escaping="yes">&nbsp;</xsl:...
*** XSLT変換 [#gd575255]
transformer.transform(
new DOMSource(document),
// new StreamResult(System.out));
new StreamResult(new FileOutputStream(new File("hogehoge...
----
この記事は
#vote(おもしろかった[3],そうでもない[1])
#comment
#topicpath
SIZE(10){現在のアクセス:&counter;}
終了行:
// 下階層用テンプレート
#topicpath
----
//ここにコンテンツを記述します。
***XMLファイルに、XSLスタイルシートを関連づけ。 [#w653b501]
<?xml-stylesheet type="text/xsl" href="midashi.xsl" ?>
***アンカーをつける [#r50b5f3c]
<a><xsl:attribute name="name">code-<xsl:value-of select=...
とすると、
<a name="code-6758" />
となる(6758はcode要素の値)。
***アンカーへのリンクを張る [#qff645a3]
<a><xsl:attribute name="href">#code-<xsl:value-of select...
とすると
<a href="#code-6758">6758</a>
となる。
***繰り返し処理で、最後以外にカンマをつける [#md326f06]
よくある処理なので、まとめておきます。
<xsl:template match="security">
<xsl:apply-templates select="attribute" />
<xsl:choose>
<xsl:when test="position()=last()" />
<xsl:otherwise>,</xsl:otherwise>
</xsl:choose>
</xsl:template>
***○○属性が存在するときのみ、表示する [#x728cc9a]
<xsl:if test="count(@name)!=0">属性[<xsl:apply-templates...
***modeの使い方 [#f45edb86]
XSLTの仕様にmodeという仕様があります。同じ要素名に対して...
<xsl:template match="security">
一覧:<xsl:apply-templates select="code" />
</xsl:template>
<xsl:template match="security" mode="detail">
詳細:<xsl:apply-templates select="code" />
</xsl:template>
と定義しておいて
一覧を表示したいところに <xsl:apply-templates select="se...
詳細を表示したいところに <xsl:apply-templates select="se...
***xslでスペース( )を入れたい [#o824c060]
<xsl:text disable-output-escaping="yes">&nbsp;</xsl:...
*** XSLT変換 [#gd575255]
transformer.transform(
new DOMSource(document),
// new StreamResult(System.out));
new StreamResult(new FileOutputStream(new File("hogehoge...
----
この記事は
#vote(おもしろかった[3],そうでもない[1])
#comment
#topicpath
SIZE(10){現在のアクセス:&counter;}
ページ名: