我在生成 ID 时打印 HTML 标记时遇到问题。我创建了两个 for 循环来为每个循环生成 id,<small>
但我不知道如何正确生成 HTML。具体来说,我无法在段落段落粗体块中打印出第二段。任何帮助表示赞赏!
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="right.xsl"?>
<div>
<ul>
<li><a href="#d1e11">(5:30 - 7:30 p.m. Downtown)</a></li>
<li><a href="#d1e17">(6:00 - 8:00 p.m. Burnaby)</a></li>
<li><a href="#d1e23">(5:30 - 6:30 p.m. Downtown)</a></li>
</ul>
<h3>Info Sessions</h3>
<a name="d1e11"></a>
<p>Full-time Programs (CST, CIT Diplomas and BTech)</p>
<p>March 8, 2012 </p>
<b><small>(5:30 - 7:30 p.m. Downtown)</small></b>
<br/>
<br/>
<a name="d1e17"></a>
<p>Computing Part-time Studies</p>
<p>March 28, 2012</p>
<b><small>(6:00 - 8:00 p.m. Burnaby)</small></b>
<br/>
<br/>
<a name="d1e23"></a>
<p>HTP - Technical Web Designer (TWD)</p>
<p>March 21, 2012</p>
<b><small>(5:30 - 6:30 p.m. Downtown)</small></b>
<br/>
<br/>
</div>
XSLT 文件
<xsl:for-each select="div/b">
<li>
<a href="#{generate-id(small)}">
<xsl:value-of select="small"/>
</a>
</li>
</xsl:for-each>
</ul>
</div>
<h3>Info Sessions</h3>
<xsl:for-each select="div/b">
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<p><xsl:value-of select="preceding-sibling::p"/></p>
<a name="{generate-id(small)}"><xsl:value-of select="small"/></a>
<hr/>
</xsl:for-each>