0
xmlを別のxml形式に変換する必要があります。ここで、すべてのセクションと章のIDを親要素のジャーナルコンテンツと順番に並べる必要があります。私はのようにユニークなIDがXSLTを使用して要素のIDを挿入します
の下に言及した出力を期待してい<?xml version="1.0" encoding="UTF-8"?><book>
<journalcontent id="001"><section>Fir</section></journalcontent>
<journalcontent id="001"><chapter>sec</chapter></journalcontent>
<journalcontent id="002"><section>thir</section></journalcontent>
<journalcontent id="002"><chapter>four</chapter></journalcontent>
<journalcontent id="003"><section>ff</section></journalcontent>
<journalcontent id="003"><chapter>66</chapter></journalcontent>
</book>
以下の出力を得た
<?xml version="1.0" encoding="UTF-8"?>
<book>
<footnote>
<journal>
<section>Fir</section> sum <chapter>sec</chapter>
</journal>
</footnote>
<footnote>
<journal>
<section>thir</section> sum <chapter>four</chapter>
</journal>
</footnote>
<footnote>
<journal>
<section>ff</section> sum <chapter>66</chapter>
</journal>
</footnote>
</book>
は、私は、XSLTを下回ることで試みたが、出力に含まは
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="book">
<book>
<xsl:apply-templates/>
</book>
</xsl:template>
<xsl:template match="//footnote">
<xsl:variable name="seq">
<xsl:number format="001" level="any"/>
</xsl:variable>
<xsl:for-each select="journal">
<xsl:if test="section">
<journalcontent>
<xsl:attribute name="id">
<xsl:value-of select="$seq"/>
</xsl:attribute>
<xsl:copy-of select="section"/>
</journalcontent>
</xsl:if>
<xsl:if test="chapter">
<journalcontent>
<xsl:attribute name="id">
<xsl:value-of select="$seq"/>
</xsl:attribute>
<xsl:copy-of select="chapter"/>
</journalcontent>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
corectではありません
<?xml version="1.0" encoding="UTF-8"?>
<book>
<journalcontent id="001"><section>Fir</section></journalcontent>
<journalcontent id="002"><chapter>sec</chapter></journalcontent>
<journalcontent id="003"><section>thir</section></journalcontent>
<journalcontent id="004"><chapter>four</chapter></journalcontent>
<journalcontent id="005"><section>ff</section></journalcontent>
<journalcontent id="006"><chapter>66</chapter></journalcontent>
</book>
誰でも手伝ってください私