0
次のようにxmlを入力します。xsltの子要素ではない指定された親要素のみを削除するには
<part type="frontmatter">
<section level="1"><title>THIEME Atlas of Anatomy</title>
........
</section>
<section level="1">
<title></title><para><emph type="bold">To access additional material
......
</section>
</part>
<part type="content">
<section level="1">
<title id="p001">Structure and Development of Organ Systems</title>
...
<section level="2">
<title>Suggested Readings</title>
.......
</section>
</section>
</part>
出力は
<part type="frontmatter">
<section level="1"><title>THIEME Atlas of Anatomy</title>
........
</section>
<section level="1">
<title></title><para><emph type="bold">To access additional material
......
</section>
</part>
<part type="content">
<title id="p001">Structure and Development of Organ Systems</title>
...
<section level="2">
<title>Suggested Readings</title>
........
</section>
</part>
私のXSLTは次のようになります。
<xsl:template match="section[position()=1]"><!-\-//-\->
<xsl:if test="preceding-sibling::part[@type='content'][not(title)]">
<part type="content">
<xsl:apply-templates select="node() | @*"/>
</part>
</xsl:if>
</xsl:template>
私は「タイトル」要素は、これら2つの間に表示されるべきではないどこ<part type="content">
の下に表示されている<section level="1">
要素を削除したいです要素。 part要素の下に "title"が表示された場合は、変更しないでください。
ありがとうございます。Tim C.以下のコードは正しく機能しています。/section [@ level = '1'] [xsl:template] xsl:template> –
Sumathi