pices: iteration

Beitrag lesen

ausgang:~~~xml <dig:instances xmlns:dig="http://www.dig.org" id="1">
  <dig:catom xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="meta:ActionWithSuccessor"/>
 </dig:instances>
 <dig:instances xmlns:dig="http://www.dig.org" id="1">
  <dig:catom xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="meta:Action"/>
 </dig:instances>
<dig:instances xmlns:dig="http://www.dig.org" id="1">
  <dig:catom xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="meta:Action"/>
 </dig:instances>

gewünschte:~~~xml
<dig:instances xmlns:dig="http://www.dig.org" id="1">  
  <dig:catom xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="meta:ActionWithSuccessor"/>  
 </dig:instances>  
 <dig:instances xmlns:dig="http://www.dig.org" id="2">  
  <dig:catom xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="meta:Action"/>  
 </dig:instances>  
<dig:instances xmlns:dig="http://www.dig.org" id="3">  
  <dig:catom xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="meta:Action"/>  
 </dig:instances>  
</dig:asks>

transformationdatei:~~~xml <xsl:attribute-set name="probe">
  <xsl:attribute name="id">xsl:number/</xsl:attribute>
 </xsl:attribute-set>

<xsl:template match="/">
 xsl:apply-templates/

</xsl:template>

<xsl:template match="xsldig:query">

<xsl:for-each select="node()">
   <xsl:copy use-attribute-sets="probe">
    <xsl:copy-of select="node()"/>
   </xsl:copy>
  </xsl:for-each>
 </xsl:template>

</xsl:stylesheet>

  
wie kann ich programmieren damit ich immer eine neue id habe wenn das programm "xsldig:query" durchläuft.