我尝试转换(在 Eclipse 中)下面的文档:
<doc>
<city name="Paris"
country="France" />
<city name="Madrid"
country="Spain" />
<city name="Vienna"
country="Austria" />
<city name="Barcelona"
country="Spain" />
<city name="Salzburg"
country="Austria" />
<city name="Bonn"
country="Germany" />
<city name="Lyon"
country="France" />
<city name="Hannover"
country="Germany" />
<city name="Calais"
country="France" />
<city name="Berlin"
country="Germany" />
</doc>
使用 xslt:
<xsl:template match="/">
<out>
<all-countries>
<xsl:copy-of select="//city" />
</all-countries>
<distinct-countries>
<xsl:copy-of select="set:distinct(//@country/..)" />
</distinct-countries>
</out>
</xsl:template>
我使用的是Xalan 2.7.1,它工作正常,但是当我使用“JRE Instance Default”处理器时出现错误:
16:07:20,642 ERROR [main] Main - java.lang.RuntimeException: Run-time internal error in 'HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. '