Как мне попросить мой XSLT-скрипт не копировать абзац, содержащий «Стратегия»?
Извините за весь код, но он должен включать всю информацию, которая вызывает у меня проблему.
Вот мой шаблон XSLT:
<xsl:when test="xhtml:li[@property = 'ktp:answer']">
<xsl:for-each select="xhtml:li[@property = 'ktp:answer']">
<xsl:variable name="answerNum" select="position()"/>
<xsl:variable name="feedbackPara"
select="../following-sibling::xhtml:section[@property = 'ktp:explanation']/xhtml:section[@property = 'ktp:explanation-section'][1]/xhtml:p[$answerNum]"/>
<xsl:variable name="feedbackParaText"
select="../following-sibling::xhtml:section[@property = 'ktp:explanation']/xhtml:section[@property = 'ktp:explanation-section'][1]/xhtml:p[$answerNum]/text()[string-length(normalize-space()) > 1][preceding-sibling::xhtml:span[contains(@class, 'mark-')[last()]] | preceding-sibling::xhtml:b[1]]"/>
<xsl:variable name="correctSpan"
select="../following-sibling::xhtml:section[@property = 'ktp:explanation']/xhtml:section[@property = 'ktp:explanation-section'][1]/xhtml:p[$answerNum]/xhtml:span"/>
<!--<xsl:variable name="tokenizefeedbackPara">
<xsl:value-of select="tokenize(normalize-space($feedbackPara), '\s')"/>
</xsl:variable>-->
<li>
<xsl:apply-templates select="@* | node()"/>
<xsl:choose>
<xsl:when
test="//xhtml:span[@property = 'ktp:interactionType'][node() = 'single-select' or node() = 'multiple-select']">
<section property="ktp:explanation" typeof="ktp:Explanation"
class="ktp-explanation jasper-exclude">
<xsl:attribute name="data-uuid">
<xsl:call-template name="assignID"/>
</xsl:attribute>
<section property="ktp:explanation-section"
typeof="ktp:feedback" data-title="Feedback"
class="ktp-explanation-section">
<xsl:attribute name="data-uuid">
<xsl:call-template name="assignID"/>
</xsl:attribute>
<p>
<xsl:attribute name="data-uuid">
<xsl:call-template name="assignID"/>
</xsl:attribute>
<xsl:choose>
<xsl:when
test="$feedbackPara[xhtml:b | xhtml:span | xhtml:i | xhtml:sup | xhtml:sub]">
<xsl:choose>
<xsl:when test="$feedbackPara[xhtml:i | xhtml:sup | xhtml:sub]">
<xsl:apply-templates
select="$feedbackPara/node()[position() > 2] except $correctSpan"
/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="
substring-after($feedbackParaText, functx:substring-before-match(
$feedbackParaText, '[A-Z0-9]'))"
/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="substring-after($feedbackPara, ') ')"/>
</xsl:otherwise>
</xsl:choose>
</p>
</section>
</section>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</li>
</xsl:for-each>
</xsl:when>
Это вывод, который я получаю. Для варианта ответа 1 вывод контента после «Стратегия:». Мне нужно пропустить абзац стратегии и включать только абзацы, начинающиеся с 1), 2), 3) и 4)
<ol class="ktp-answer-set">
<li property="ktp:answer" typeof="ktp:Answer">Chef salad, crackers, and iced
tea.
<section property="ktp:explanation" typeof="ktp:Explanation" class="ktp-explanation jasper-exclude">
<section property="ktp:explanation-section" typeof="ktp:feedback" data-title="Feedback" class="ktp-explanation-section">
<p>Recall foods that are
high in protein.
</p>
</section>
</section>
</li>
<li property="ktp:answer" typeof="ktp:AnswerCorrect">Broiled fish, cream of tomato soup
topped with grated cheese, and custard.
<section property="ktp:explanation" typeof="ktp:Explanation" class="ktp-explanation jasper-exclude">
<section property="ktp:explanation-section" typeof="ktp:feedback" data-title="Feedback" class="ktp-explanation-section">
<p>A chef salad contains pieces of ham and cheese, which have protein. Crackers and iced
tea do not contain protein. The majority of foods selected do not contain protein.
</p>
</section>
</section>
</li>
<li property="ktp:answer" typeof="ktp:Answer">Peanut butter and jelly sandwich,
chips, and fruit drink.
<section property="ktp:explanation" typeof="ktp:Explanation" class="ktp-explanation jasper-exclude">
<section property="ktp:explanation-section" typeof="ktp:feedback" data-title="Feedback" class="ktp-explanation-section">
<p>All foods selected contain protein. Protein can be increased by adding skim milk to
appropriate foods, adding grated cheese to foods, using peanut butter as a spread
on fruits and vegetables, using yogurt as a topping for fruit and cake.
</p>
</section>
</section>
</li>
<li property="ktp:answer" typeof="ktp:Answer">Turkey sandwich with lettuce and
tomato, potato salad, and milk.
<section property="ktp:explanation" typeof="ktp:Explanation" class="ktp-explanation jasper-exclude">
<section property="ktp:explanation-section" typeof="ktp:feedback" data-title="Feedback" class="ktp-explanation-section">
<p>Peanut butter contains protein, but the other foods do not.</p>
</section>
</section>
</li>
</ol>
Это желаемый вывод, который помещает объяснение выбора ответа 1 ) под правильным выбором ответа:
<ol class="ktp-answer-set">
<li property="ktp:answer" typeof="ktp:Answer">Chef salad, crackers, and iced
tea.
<section property="ktp:explanation" typeof="ktp:Explanation" class="ktp-explanation jasper-exclude">
<section property="ktp:explanation-section" typeof="ktp:feedback" data-title="Feedback" class="ktp-explanation-section">
<p>A chef salad contains pieces of ham and cheese, which have protein. Crackers and iced tea do not contain protein. The majority of foods selected do not contain protein.
</p>
</section>
</section>
</li>
<li property="ktp:answer" typeof="ktp:AnswerCorrect">Broiled fish, cream of tomato soup
topped with grated cheese, and custard.
<section property="ktp:explanation" typeof="ktp:Explanation" class="ktp-explanation jasper-exclude">
<section property="ktp:explanation-section" typeof="ktp:feedback" data-title="Feedback" class="ktp-explanation-section">
<p>All foods selected contain protein. Protein can be increased by adding skim milk to appropriate foods, adding grated cheese to foods, using peanut butter as a spread on fruits and vegetables, using yogurt as a topping for fruit and cake.
</p>
</section>
</section>
</li>
<li property="ktp:answer" typeof="ktp:Answer">Peanut butter and jelly sandwich,
chips, and fruit drink.
<section property="ktp:explanation" typeof="ktp:Explanation" class="ktp-explanation jasper-exclude">
<section property="ktp:explanation-section" typeof="ktp:feedback" data-title="Feedback" class="ktp-explanation-section">
<p>Peanut butter contains protein, but the other foods do not.
</p>
</section>
</section>
</li>
<li property="ktp:answer" typeof="ktp:Answer">Turkey sandwich with lettuce and
tomato, potato salad, and milk.
<section property="ktp:explanation" typeof="ktp:Explanation" class="ktp-explanation jasper-exclude">
<section property="ktp:explanation-section" typeof="ktp:feedback" data-title="Feedback" class="ktp-explanation-section">
<p>Turkey and milk contain protein, but potato salad very little if any.</p>
</section>
</section>
</li>
</ol>
Это содержимое, из которого мне нужно только скопировать текст, который начинается с 1), 2), 3) и 4) и пропустить параграф «Стратегия»:
<section property="ktp:explanation-section" typeof="ktp:summary" data-title="Summary" class="ktp-explanation-section">
<p><b>Strategy:</b> Recall foods that are high in protein.
</p>
<p>1) A chef salad contains pieces of ham and cheese, which have protein. Crackers and
iced tea do not contain protein. The majority of foods selected do not contain protein.
</p>
<p>2) <b>CORRECT</b> — All foods selected contain protein. Protein can be increased by adding skim milk
to appropriate foods, adding grated cheese to foods, using peanut butter as a spread
on fruits and vegetables, using yogurt as a topping for fruit and cake.
</p>
<p>3) Peanut butter contains protein, but the other foods do not.</p>
<p>4) Turkey and milk contain protein, but potato salad very little if any.</p>
</section>