我在下面有 xml 文件和 xslt 转换:
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet version="1.0" type="text/xml" href="pets.xsl" ?>
<pets>
<pet name="Jace" type="dog" />
<pet name="Babson" type="" />
<pet name="Oakley" type="cat" />
<pet name="Tabby" type="dog" />
</pets>
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:key name="pets-key" match="pet" use="type" />
<xsl:template match="/" >
<html>
<head><title></title></head>
<body>
<xsl:for-each select="key('pets-key', '' )" >
<xsl:value-of select="@name" />
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
如何使用按键功能选择所有类型不为空的宠物?