这是我需要从中生成 xslt 的 xml 数据。
<root>
<entry id="1">
<headword>go</headword>
<example>I <hw>go</hw> to school.</example>
</entry>
<entry id="2">
<headword>come</headword>
<example>I <verb>came</verb> back home.</example>
</entry>
我想创建一个这样的html:
<html>
<body>
<div class="entry" id="1">
<span class="headword">go</span>
<span class="example">I <span class="hw">go</span> to school.</span>
</div>
<div class="entry" id="2">
<span class="headword">comeo</span>
<span class="example">I <span class="hw">came</span> back home.</span>
</div>
</body>
</html>
这是我的 xslt:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="root/entry">
<div class="entry">
<span class="headword">
<xsl:value-of select="headword"/>
</span>
<span class="example">
<xsl:value-of select="example"/>
</span>
</div>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
我不知道如何转换属性“id”和元素“hw”的值。