У меня есть следующий набор кодов для XML-списка, и я использую следующий XSLT для извлечения содержимого, но он не работает. Первый и последний работают нормально, но средний создает проблему. Любая помощь, пожалуйста .......Список через XSLT
XML:
<cl:sect1 identifier="ZQRRUG590702676" number="nonumber">
<cl:complex-meta>
<cl:title identifier="PLHOOC548347957">Questions for Review and Reflection</cl:title>
</cl:complex-meta>
<cl:quiz identifier="UUHXZX749864214">
<cl:metadata-wrapper>
<cl:descriptive-meta>
<cl:broad-term>Chapter exercises</cl:broad-term>
</cl:descriptive-meta>
</cl:metadata-wrapper>
<cl:question-section identifier="LMUGHP665075315">
<cl:short-answer-section identifier="PDWZPT096484135">
<cl:quiz-meta>
<cl:numbering role="style" target-node="question">arabic</cl:numbering>
</cl:quiz-meta>
<cl:sa-item identifier="DHUJEX954944222">
<cl:question identifier="ZXPROB877164447"><cl:para identifier="UVPIYI046459379">Choose one of the theoretical perspectives on the family, and discuss how you might use it to understand something about life in <cl:style identifier="XWHGPG736884704" styles="italic">your</cl:style> family.</cl:para></cl:question>
</cl:sa-item>
<cl:sa-item identifier="XLIHNY049827846">
<cl:question identifier="WBNMFT023816273"><cl:para identifier="MVVFTE506398129">Choose a magazine photo and analyze its content from one of the perspectives de-scribed in this chapter. Then analyze the photo from another theoretical perspective. How do your insights differ depending on which theoretical perspective is used?</cl:para></cl:question>
</cl:sa-item>
<cl:sa-item identifier="KHOISZ206843547">
<cl:question identifier="YIRLTY425252173"><cl:para identifier="DEAOVV858913951">Discuss why science is often considered a better way to gain knowledge than is personal experience alone. When might this not be the case?</cl:para></cl:question>
</cl:sa-item>
<cl:sa-item identifier="UZUXJL108947882">
<cl:question identifier="NOBHFC190777617"><cl:para identifier="CISHBM348415557">Think of a research topic, then review the data-gathering techniques described in this chapter to decide which of these you might use to investigate your topic.</cl:para></cl:question>
</cl:sa-item>
<cl:sa-item identifier="ZITOCE439682847">
<cl:question identifier="MCRAPB388676722"><cl:para identifier="RTRSPD372632657"><cl:key-term-entry identifier="JTBDZT820091835"><cl:key-term identifier="VSNZVL072560329">Policy Question</cl:key-term></cl:key-term-entry>. What aspect of family life would it be helpful for policy makers to know more about as they make law and design social programs? How might this topic be researched? Is it controversial?</cl:para></cl:question>
</cl:sa-item>
</cl:short-answer-section>
</cl:question-section>
</cl:quiz>
</cl:sect1>
XSLT:
<xsl:template match="cl:closer/cl:sect1/cl:quiz/cl:question-section/cl:short-answer-section/cl:sa-item[1]/cl:question[1]/cl:para">
<xsl:element name="ParagraphStyleRange">
<xsl:attribute name="AppliedParagraphStyle">ParagraphStyle/EOCNLF</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="cl:closer/cl:sect1/cl:quiz/cl:question-section/cl:short-answer-section/cl:sa-item[not(position() = last())]/cl:question[not(position()=last())]/cl:para">
<xsl:element name="ParagraphStyleRange">
<xsl:attribute name="AppliedParagraphStyle">ParagraphStyle/EOCNLM</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="cl:closer/cl:sect1/cl:quiz/cl:question-section/cl:short-answer-section/cl:sa-item[position()=last()]/cl:question[position()=last()]/cl:para">
<xsl:element name="ParagraphStyleRange">
<xsl:attribute name="AppliedParagraphStyle">ParagraphStyle/EOCNLL</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
Thanks Ian! Я действительно ценю это. Спасибо Большое. –
@UmeshKahali рад, что это помогло. В Stack Overflow обычным способом поблагодарить кого-то за правильный ответ является _accept_ его, нажав на отметку слева от ответа (и вы улучшите свой собственный рейтинг репутации, сделав это тоже). –