間のカウント・ノードがXMLである:私は<fruit>
と前回の間で文章の#をカウントする必要がXSLT:ここでは、2つの特定のノード
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
</xsl:template>
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="file/text/p/sentence[fruit]”/>
</body>
</html>
</xsl:template>
<xsl:template match="sentence[fruit]”>
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
</xsl:stylesheet>
と:ここ
<?xml version="1.0" encoding="UTF-8"?>
<file>
<text>
<p>
<sentence>I bought <fruit>kiwi</fruit> at the grocery store.</sentence>
<sentence>I also bought <fruit>bananas</fruit> at the store.</sentence>
<sentence base="basket">Then, I bought a basket at another store.</sentence>
<sentence>You bought <fruit>peaches</fruit> at the grocery store.</sentence>
<sentence>You also bought <fruit>apples</fruit> at the store.</sentence>
<sentence>he bought <fruit>pears</fruit> at the grocery store.</sentence>
<sentence base="basket">Then, You bought a <fruit>oranges</fruit> and a basket at another store.</sentence>
<sentence>He also bought <fruit>lemons</fruit> at the store.</sentence>
</p>
</text>
</file>
変更する必要がXSLTであります<sentence base="basket">
の後に続きます。 <fruit>
オレンジ</fruit>
は<sentence base=“basket”>
内部にある間、例えば、<fruit>
リンゴ</fruit>
は(-0 + 0)、別の<sentence base=“basket”>
(+2)前<sentence base=“basket”>
(-2)および2つの<sentence>
後2 <sentence>
です。
助けてください。ここで私は必要な出力は次のようになります。
私は食料品店でキウイを買った(なし、2)
私も店でバナナを買った(なし、1)
あなたは桃を買いました。食料品店で。 (-1、+3)
また、リンゴを店で購入しました。 (-2、+2)
彼は梨の食料品店を買った。 (-3、+1)
次に、オレンジとバスケットを別の店で購入しました。 (0,0)
彼はまた店でレモンを買った。 (-1、なし)
感謝を。完璧! –