我尝试使用下面的XSLT查询XML文件:XSLT破:模式不匹配
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:bpmn="http://dkm.fbk.eu/index.php/BPMN_Ontology">
<!-- Participants -->
<xsl:template match="/">
<html>
<body>
<table>
<xsl:for-each select="Package/Participants/Participant">
<tr>
<td><xsl:value-of select="ParticipantType" /></td>
<td><xsl:value-of select="Description" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
下面是XML文件的内容:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="xpdl2bpmn.xsl"?>
<Package xmlns="http://www.wfmc.org/2008/XPDL2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Id="25ffcb89-a9bf-40bc-8f50-e5afe58abda0" Name="1 price setting" OnlyOneProcess="false">
<PackageHeader>
<XPDLVersion>2.1</XPDLVersion>
<Vendor>BizAgi Process Modeler.</Vendor>
<Created>2010-04-24T10:49:45.3442528+02:00</Created>
<Description>1 price setting</Description>
<Documentation />
</PackageHeader>
<RedefinableHeader>
<Author />
<Version />
<Countrykey>CO</Countrykey>
</RedefinableHeader>
<ExternalPackages />
<Participants>
<Participant Id="008af9a6-fdc0-45e6-af3f-984c3e220e03" Name="customer">
<ParticipantType Type="RESOURCE" />
<Description />
</Participant>
<Participant Id="1d2fd8b4-eb88-479b-9c1d-7fe6c45b910e" Name="clerk">
<ParticipantType Type="ROLE" />
<Description />
</Participant>
</Participants>
</Package>
尽管如此,简单的模式,该foreach不起作用。有什么问题套餐/参与者/参与者?我在这里错过什么?有没有关于命名空间的东西,我没有得到?
非常感谢!
问得好(+1)。查看我的答案,获取描述代码中两个问题的完整解决方案,并演示如何解决这些问题。 :) – 2010-04-24 16:19:52