0
选择车名我有下面的XML文件:XSLT - 用户
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet version="1.0" type="text/xml" href="template.xsl" ?>
<source>
<man name="John" surname="Piterson" >
<cars>
<car name="Lamborgini Gallardo" maxspeed="400km" />
<car name="Honda" maxspeed="200km" />
</cars>
<appartments>
<appartment city="New York" />
<appartment city="Tokio" />
</appartments>
</man>
</source>
,我有以下的XSL模板,它应该显示汽车的名单
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/" >
<html>
<body>
<h1>Users info</h1>
<div><strong>The cars of John</strong></div>
<xsl:for-each select="/man/cars/car" >
<div>
<xsl:value-of select="[email protected]" />
</div>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
我需要打印所有汽车约翰的名字,<xsl:for-each
- 在这种情况下不起作用,该怎么做?
是的,它的工作,谢谢! – testCoder