・HTMLでVML描画する場合と同様に、XSL内でHTMLタグを記述。
[サンプルXML文書を表示](下のフレームに)
XMLソース
<?xml version="1.0" encoding="Shift_JIS" ?> <?xml-stylesheet type="text/xsl" href="vml02.xsl"?> <start> <top>XML文書でVML描画</top> <contents> <直線> <left>100</left> <top>50</top> <from>0,0</from> <to>400,150</to> <fillcolor>red</fillcolor> <strokecolor>blue</strokecolor> <strokeweight>8px</strokeweight> </直線> <四角形> <left>150</left> <top>80</top> <width>300</width> <height>100</height> <fillcolor>#cdcdcd</fillcolor> <strokecolor>green</strokecolor> <strokeweight>3px</strokeweight> </四角形> </contents> <end>以上です(00/11/15)</end> </start>
XSLソース
<?xml version="1.0" encoding="Shift_Jis"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <HTML xmlns:v="urn:schemas-microsoft-com:vml"> <HEAD> <STYLE>v\:* { behavior: url(#default#VML) }</STYLE> </HEAD> <BODY> <H3><xsl:value-of select="start/top"/></H3> <v:line> <xsl:apply-templates select="start/contents/直線"/> </v:line> <v:rect> <xsl:apply-templates select="start/contents/四角形"/> </v:rect> </BODY></HTML> </xsl:template> <xsl:template match="start/contents/直線"> <xsl:attribute name="style"> position:absolute; left:<xsl:value-of select="left" />; top:<xsl:value-of select="top" /> </xsl:attribute> <xsl:attribute name="from"> <xsl:value-of select="from" /> </xsl:attribute> <xsl:attribute name="to"> <xsl:value-of select="to" /> </xsl:attribute> <xsl:attribute name="strokecolor"> <xsl:value-of select="strokecolor" /> </xsl:attribute> <xsl:attribute name="strokeweight"> <xsl:value-of select="strokeweight" /> </xsl:attribute> </xsl:template> <xsl:template match="start/contents/四角形"> <xsl:attribute name="style"> position:absolute; left:<xsl:value-of select="left" />; top:<xsl:value-of select="top" />; width:<xsl:value-of select="width" />; height:<xsl:value-of select="height" />; </xsl:attribute> <xsl:attribute name="fillcolor"> <xsl:value-of select="fillcolor" /> </xsl:attribute> <xsl:attribute name="strokecolor"> <xsl:value-of select="strokecolor" /> </xsl:attribute> <xsl:attribute name="strokeweight"> <xsl:value-of select="strokeweight" /> </xsl:attribute> </xsl:template> </xsl:stylesheet>
end(00/11/15)