XMLにHTMLタグを書き,これをそのまま出力するXSLの書き方。 <div>例えば,これをXMLに書き</div> <div><a href="http://hoge">そのタグのまま出力する</a></div>
XMLは次のようなもの <data> <test idx="1"> <table border="1"> <tr> <td><div style="font:bold;color:red;">ぼたん1です</div></td> <td>こんにちは,ぼたん1です</td> </tr> </table> </test> <test idx="2"> <ul> <li><div style="color:blue; font-size: 150%; ">ぼたん2です</div></li> <li>ぼたん2です</li> </ul> </test> </data>
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="UTF-8"/> <xsl:param name="jump"/> <xsl:template match="/"> <xsl:apply-templates select="data/test[@idx=$jump]"/> </xsl:template> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet>