|
<xsl:attribute-set><xsl:attribute-set name="qname" use-attribute-sets="qnames"> ・・・ </xsl:attribute-set>xsl:attribute-setは、あらかじめ属性の集合を定義しておき、要素に適用できるようにします。 よく使用する属性値をあらかじめ定義しておく事で、その都度属性を指定しなくとも、 参照するだけで適用させる事ができます。
■ aaa.xml
<?xml version="1.0" encoding="Shift_JIS"?>
<?xml-stylesheet type="text/xsl" href="bbb.xsl"?>
<data>
<site>
<name>全部まるごとスタイルシート</name>
<url>http://ykr414.com/css/</url>
<imgurl>http://ykr414.com/index/css.gif</imgurl>
<des>カスケーディングスタイルシートの基礎・使用法。</des>
</site>
<site>
<name>伸び縮みマークアップ言語 XML</name>
<url>http://ykr414.com/xml/</url>
<imgurl>http://ykr414.com/index/xml.gif</imgurl>
<des>XMLやXSLTの基礎・使用法。</des>
</site>
</data>
■ bbb.xsl <?xml version="1.0" encoding="Shift_JIS"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:attribute-set name="image"> <xsl:attribute name="width">80</xsl:attribute> <xsl:attribute name="height">31</xsl:attribute> <xsl:attribute name="src"> <xsl:value-of select="imgurl"/> </xsl:attribute> </xsl:attribute-set> <xsl:template match="data"> <html> <body> <xsl:apply-templates /> </body> </html> </xsl:template> <xsl:template match="site"> <table> <tr> <td> <img xsl:use-attribute-sets="image"/> </td> <td style="font-size:11px"> <div> <xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="url"/> </xsl:attribute> <xsl:value-of select="name"/> </xsl:element> </div> <xsl:value-of select="des"/> </td> </tr> </table> </xsl:template> </xsl:stylesheet> |
XSLT要素一覧
+ <xsl:apply-imports>
+ <xsl:apply-templates> + <xsl:attribute> + <xsl:attribute-set> + <xsl:call-template> + <xsl:comment> + <xsl:copy> + <xsl:copy-of> + <xsl:decimal-format> + <xsl:element> + <xsl:fallback> + <xsl:for-each> + <xsl:if> + <xsl:import> + <xsl:include> + <xsl:key> + <xsl:message> + <xsl:namespace-alias> + <xsl:number> + <xsl:otherwise> + <xsl:output> + <xsl:param> + <xsl:preserve-space> + <xsl:processing-instruction> + <xsl:sort> + <xsl:strip-space> + <xsl:stylesheet> + <xsl:template> + <xsl:text> + <xsl:value-of> + <xsl:variable> + <xsl:when> + <xsl:with-param> |
Copyright © 2006 - ykr414 . All Rights Reserved. |