XSLT-检查XML文件中是否存在子元素属性
假设xml文件中有如下内容:XSLT-检查XML文件中是否存在子元素属性,xml,xslt,Xml,Xslt,假设xml文件中有如下内容: <student name="bob"> <grades exam1="98" exam2="53"/> <status>GOOD</status> </student> 在我的xslt中,我有如下内容: <xsl:choose> <xsl:when test="(student/status[text()='GOOD']) and not(student/gra
<student name="bob">
<grades exam1="98" exam2="53"/>
<status>GOOD</status>
</student>
在我的xslt中,我有如下内容:
<xsl:choose>
<xsl:when test="(student/status[text()='GOOD']) and not(student/grades/@exam1)">
<!--passed code here-->
</xsl:when>
<xsl:otherwise>
<!--otherwise code here-->
</xsl:choose>
现在,条件的第一部分起作用,即检查状态是否良好,但第二部分不起作用,即检查学生是否没有考试成绩1,以便进入“此处通过的代码”部分,我只想看看那些具备以下条件的学生:
<student name="mary">
<grades exam2="53"/>
<status>GOOD</status>
</student>
因此,等级下没有exam1属性。我真的不知道我在上面给出的条件陈述中做错了什么
感谢您的帮助。请使用以下文档:
<root>
<student name="bob">
<grades exam1="98" exam2="53"/>
<status>GOOD</status>
</student>
<student name="mary">
<grades exam2="53"/>
<status>GOOD</status>
</student>
</root>
这导致:
asdf
fdsa
你的教学内容是什么?那你为什么需要指导呢?你为什么不选择那些符合标准的学生呢?如果你发布了一个有2个或更多学生参与的输入示例,以及转换该示例的预期输出,那会更好。
asdf
fdsa