|
HTML和XSLT(3) < /excerpt> < excerpt> < verse>For who can yet believe, though after loss< /verse> < verse>That all these puissant Leginos, whose exile< /verse> < verse>Hath emptied Heav'n, shall fail to re-ascend< /verse> < verse>Self-rais'd, and repossess their native seat.< /verse> < /excerpt> < /poem> to this:
得到的效果是:
< !DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> < html> < body> < h1>From Book I< /h1> < p> Then with expanded wings he steers his flight< br> Aloft, incumbent on the dusky Air< br> that felt unusual weight, till on dry Land< br> He lights, if it were Land that ever burne'd< br> With solid, as the Lake with liquid fire;< br> < /p> < hr> < p> For who can yet believe, though after loss< br> That all these puissant Leginos, whose exile< br> Hath emptied Heav'n, shall fail to re-ascend< br> Self-rais'd, and repossess their native seat.< br> < /p> < hr> < /body> < /html>
可以看到,每一个excerpt元素替换成一个p元素,并且在后面加了一个横线,每一个verse元素替换成一个br元素。
因为样式表里的xsl:output元素属性的作用,上面例子最后生成的文档中br和hr元素是没有结束标识"/"的,正如原来的HTML一样。这样的文档在任何版本浏览器中都不会有问题。
通过Dave Raggett的Tidy程序和xsl:output
|