変換が完了したら、すべての空の要素を削除しようとしていますが、うまくいきません。私は次のXMLを持っています
<root>
<record name='1'>
<Child1>value1</Child1>
<Child2>value2</Child2>
</record>
<record name='2'>
<Child1>value1</Child1>
<Child2>value2</Child2>
</record>
<record name='3'>
<Child1>value1</Child1>
<Child2>value2</Child2>
</record>
</root>
出力を
<root>
<record name="1">
<Element>1</Element>
</record>
</root>
ただし、空のレコード要素もすべて取得し続けており、それらを取り除く方法がわかりません。
<root>
<record>
<Element>1</Element>
</record>
<record/>
<record/>
</root>
これは私のスタイルシートです
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//record">
<xsl:copy>
<xsl:call-template name="SimpleNode"/>
</xsl:copy>
</xsl:template>
<xsl:template name="SimpleNode">
<xsl:if test="@name = '1'">
<Element><xsl:value-of select="@name"/></Element>
</xsl:if>
</xsl:template>
</xsl:stylesheet>