以下のような XSLT があり、この xslt を入力 xml [下に貼り付け] に適用します。明確にする必要がある 1 つのことを除いて、正常に動作しています。
これは入力xmlです
<Test>
<Experiment id='1'>
<Dish1>
<Conditions pressure='x' temp='y'/>
<Measurement timeStamp='8am' reading='y'/>
</Dish1>
<Dish2>
<Conditions pressure='x' temp='y'/>
<Measurement timeStamp='8am' reading='y'/>
</Dish2>
<Dish1>
<Conditions pressure='x' temp='y'/>
<Measurement timeStamp='2pm' reading='y'/>
</Dish1>
<Dish2>
<Conditions pressure='x' temp='y'/>
<Measurement timeStamp='2pm' reading='y'/>
</Dish2>
</Experiment>
<Experiment id='2'>
<Dish1>
<Conditions pressure='x' temp='y'/>
<Measurement timeStamp='9am' reading='y'/>
</Dish1>
</Experiment>
</Test>
これはxsltです
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="Experiment">
<xsl:copy>
<xsl:apply-templates select="@*" />
<xsl:for-each-group select="*" group-by="local-name()">
<xsl:copy>
<xsl:apply-templates select="current-group()" />
</xsl:copy>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
<xsl:template match="Experiment/*">
<Observation>
<xsl:apply-templates select="*/@*" />
</Observation>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
これは変換が正常に機能していることです。しかし、xslt で以下のように変更すると、エラーが発生します。何か案が?
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="."/>
</xsl:copy>
</xsl:template>
つまり、前回の試合で、私は から <xsl:apply-templates select="@*|node()"/>
に変わりました <xsl:apply-templates select="."/>