开发者

What is wrong with this XPath?

Give开发者_JAVA技巧n that the path /XML/Staff/Content/ContentXML/StaffProfile/Role is correct, and that I have 5 /XML/Staff with only one Staff member with the Role of "Partner"

Why does this match all 5 staff members?

<xsl:apply-templates select="/XML/Staff[Content/ContentXML/StaffProfile/Role='Partner']" mode="List"/>


I haven't seen your XML (which you should post for completeness), but I assume Role is an XML element and if that's the case, comparing it to a string won't work. Try this:

<xsl:apply-templates 
    select="/XML/Staff[Content/ContentXML/StaffProfile/Role/text()='Partner']"
    mode="List" />

If Role is an attribute, you need to do this:

<xsl:apply-templates 
    select="/XML/Staff[Content/ContentXML/StaffProfile/@Role='Partner']"
    mode="List" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜