Я пытаюсь получить неправильные и правильные значения в начале абзаца при выполнении условия.
В HTML ниже, в <li property="ktp:answer">
, когда присутствует typeof="ktp:Answer
, я вывод объяснения должен начинаться с «Неправильно», а когда присутствует typeof="ktp:AnswerCorrect
, вывод объяснения должен начинаться с «Правильно».
<ol class="ktp-answer-set">
<li property="ktp:answer" typeof="ktp:Answer">“I cough in the morning, but it stops.”
<section property="ktp:explanation" typeof="ktp:Explanation" class="ktp-explanation jasper-exclude">
<section property="ktp:explanation-section" typeof="ktp:feedback" class="ktp-explanation-section" data-title="Feedback">
<p>Captopril is an angiotensin-converting enzyme inhibitor (ACE-I) that has a dry, hacking, persistent cough as an adverse effect. The client reports a morning cough that may or may not be associated with the medication.
</p>
</section>
</section>
</li>
<li property="ktp:answer" typeof="ktp:AnswerCorrect">“I am waiting to learn the results of my pregnancy test.”
<section property="ktp:explanation" typeof="ktp:Explanation" class="ktp-explanation jasper-exclude">
<section property="ktp:explanation-section" typeof="ktp:feedback" class="ktp-explanation-section" data-title="Feedback">
<p>ACE-Is are contraindicated in pregnancy. There is a black box warning that states ACE-I can cause injury and even death to a developing fetus. Since the client reports waiting for the results of a pregnancy test, this should be reported immediately to the health care provider.
</p>
</section>
</section>
</li>
</ol>
Вот часть моего скрипта XSLT, которая преобразует эта часть текста. Неправильная и правильная часть не работает правильно.
<section property="ktp:explanation-section" typeof="ktp:feedback" data-title="Feedback"
class="ktp-explanation-section atom-exclude">
<xsl:for-each select="//xhtml:section[@data-title='Feedback']">
<p class="atom-exclude">
<xsl:value-of select="position()"></xsl:value-of>
<xsl:text>)</xsl:text>
<xsl:choose>
<xsl:when test="//xhtml:li[@typeof='ktp:Answer']">
<span class="mark-false"><xsl:text> INCORRECT</xsl:text></span> – <xsl:value-of select="."/>
</xsl:when>
<xsl:otherwise>
<span class="mark-true"><xsl:text> CORRECT</xsl:text></span> – <xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</p>
</xsl:for-each>
</section>