- PR -

HTMLタグに一括いて属性を付加する方法

投稿者投稿内容
MMX
ぬし
会議室デビュー日: 2001/10/26
投稿数: 861
投稿日時: 2001-11-30 00:47
グローバル定数のも、ついでにやっておきます。
コード:
<?xml version="1.0" encoding="Shift_JIS"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
              xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                version="1.0">
                
<xsl:param name="const1"><!-- 筋子 -->
<attrs bgcolor="#CCCC99" border="1" bordercolor="#000000"/>
</xsl:param>
<xsl:param name="const2" 
select="msxsl:node-set($const1)//@*"/><!-- ばら子 -->

<xsl:template match="/"> <html><head><title>defauatt</title></head><body>
<table><xsl:copy-of select="msxsl:node-set($const1)//@*"/>
<tr><td>sljf</td></tr>
</table><br/>
<table><xsl:copy-of select="$const2"/>
<tr><td>sljf</td></tr>
</table>
</body></html>
</xsl:template>
<!-- XSLTのコンパイラが定数計算の最適化を十分するなら
     どちらでも、よいと思う  -->
</xsl:stylesheet>


attribute-set って浅いシンタックス・シュガーみたいだ。

スキルアップ/キャリアアップ(JOB@IT)