私のXML文書が見えます:xslt for-eachをアトリビュートに適用するにはどうすればよいですか?私は、このような「id」属性値として、それを変換したいthis-</p> <p>は、例えば順次インクリメントされるように
<doc>
<system_data>
<registry_item id="10">
<hive>HKEY_LOCAL_MACHINE</hive>
</registry_item>
<file_item id="11">
<filepath>C:\Windows\System32\msasn1.dll</filepath>
</file_item>
</system_data>
</doc>
私は「identity」のデザインを使用していますし、私のxslはこのように見えます。
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xslt="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="Identity.xsl"/>
<xslt:param name="newID" />
<xsl:template match="//system_data/*">
<xsl:for-each select="@id">
<xsl:attribute name="id">
<xsl:value-of select="number($newID)+1"/>
</xsl:attribute>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
私はnewIDの値を "10"として渡しています。各属性を選択してその値を増やす方法は?私は、XSLを適用すると
Indentity.xslがthis-
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Whenever you match any node or any attribute -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
のように見える、私は次のようになっていますエラー -
An attribute node (id) cannot be created after the children of the containing element
こんにちは、あなたは同様の問題を助けることができますかhttp://stackoverflow.com/questions/12289248/xslt-attribut e-node-id-children-of-the-containingを後で作成することはできません – bouncingHippo