我在让 XSLT 脚本不拉取<li>
原始输入文件中的标签时遇到了麻烦。请参见下面我的输出屏幕截图中红色圆圈区域:
我遇到问题的脚本部分如下:
<xsl:template match="xhtml:ol[@property = 'ktp:questionSet']">
<xsl:param name="path"/>
<xsl:variable name="content-item-name"
select="//xhtml:section/xhtml:span[@property = 'atom:content-item-name']/@data-value"/>
<li class="ktp-question" property="ktp:question" typeof="ktp:Question">
<section class="ktp-question-set-meta">
<xsl:apply-templates
select="(//xhtml:section[@class = 'ktp-meta' and not(@property = 'ktp:questionSetType')])[position() = 3 or position() = 4]"/>
</section>
<section property="ktp:stimulus" typeof="ktp:Stimulus" class="ktp-stimulus">
<xsl:apply-templates
select="xhtml:li[@class = 'ktp-stimulus']/node()"/>
</section>
<section class="ktp-question-stem">
<xsl:apply-templates
select="//xhtml:section[@class = 'ktp-question-stem']/node()"/>
</section>
<ol class="ktp-answer-set">
<xsl:apply-templates
select="//xhtml:ol[contains(@class, 'ktp-answer-set')]/node()"/>
</ol>
<section property="ktp:explanation" typeof="ktp:Explanation"
class="ktp-explanation">
<xsl:apply-templates
select="//xhtml:section[@class = 'ktp-explanation']/node()"/>
</section>
</li>
</xsl:template>
我正在处理的输入文件如下:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<link href="../../assets/css/main.css" rel="stylesheet" title="default" type="text/css" />
<title>ptalme03</title>
</head>
<body>
<ol class="ktp-question-set" >
<li><ol property="ktp:questionSet" typeof="ktp:QuestionSet" class="ktp-question-set">
<li class="ktp-question-set-meta"><section property="ktp:metadata"
class="ktp-meta">
<span property="atom:content-item-name" class="ktp-meta"
data-value="ptalme03"></span>
</section><section property="ktp:tags" class="ktp-meta">
<span property="ktp:questionSetType" class="ktp-meta"
>shared-stimulus</span>
</section></li>
<li property="ktp:stimulus" typeof="ktp:Stimulus" class="ktp-stimulus"><p>
<img src="../../img/alpha_images_pt1/SAT_PT_math2_Q3.svg" />
</p></li>
<li property="ktp:question" typeof="ktp:Question" class="ktp-question">
<span property="atom:content-item-name" class="ktp-meta" data-value="ptalme03"></span>
<section class="ktp-question-meta">
<section class="ktp-meta" property="ktp:metadata">
<span class="ktp-meta" data-value="ptalme03"
property="atom:content-item-name"></span>
</section>
<section class="ktp-meta" property="ktp:tags">
<span class="ktp-meta" property="ktp:interactionType"
>single-select</span>
<span class="ktp-meta" property="OLD QID">ftm02.03</span>
</section>
</section><section class="ktp-question-stem">
<p>What is the <i>x</i>-intercept of the graph shown? </p>
</section><ol class="ktp-answer-set">
<li property="ktp:answer" typeof="ktp:AnswerCorrect">(−1, 0)</li>
</ol><section property="ktp:explanation" typeof="ktp:Explanation"
class="ktp-explanation">
<section class="ktp-explanation-section" data-title="Feedback"
data-uuid="e955d9441cc051f966008c9d6da75adc"
property="ktp:explanation-section" typeof="ktp:feedback">
<p><b>Getting to the Answer:</b> The <i>x</i>-intercept is the point
where the graph crosses the <i>x</i>-axis. The graph crosses the
<i>x</i>-axis at (−1, 0). <b>(A)</b> is correct. </p>
</section>
</section>
</li>
</ol>
</li>
</ol>
</body>
</html>