【发布时间】:2014-10-03 21:43:03
【问题描述】:
鉴于下面我无法更改的 Xml,是否可以仅使用一个 css 文件获得条件结果。目前我只能使用一个 css,但据我了解 css 在条件方面非常有限。
案例 1:
<doc>
<story>
<c1><p><text-web-group class="MajorEvent"><text-web class="MajorEvent">Sample Text C1</text-web></text-web-group></p></c1>
</story>
</doc>
案例 2:
<doc>
<story>
<c1><p><text-web-group class="MajorEvent"><text-web class="MajorEvent">Sample Text C1</text-web></text-web-group></p></c1>
<c2><p><text-web-group class="MajorEvent"><text-web class="MajorEvent">Sample Text C2</text-web></text-web-group></p></c2>
</story>
</doc>
案例 3
<doc>
<story>
<c2><p><text-web-group class="MajorEvent"><text-web class="MajorEvent">Sample Text C2</text-web></text-web-group></p></c2>
</story>
</doc>
- CASE 1. Sample Text C1 仅在 C1/p/text-web-group/text-web 中有文本时显示
- CASE 2. 如果 C1/p/text-web-group/text-web 和 C2/p/text-web-group/ 中都有文本,则仅显示 Sample Text C1文字网
- CASE 3. Sample Text C2 仅在 C2/p/text-web-group/text-web 中有文本时显示
【问题讨论】:
-
那么你的问题是什么?
-
当前的 CSS 规范不允许你做你想做的事。您的 XML 组织方式不允许您使用 :empty 设置样式,并且您需要定位父对象,CSS Selectors Level 4 中的某些东西(可能)在今天没有浏览器可用。
-
@LeBen,你应该这样回答。