wie setzen aktuelle iteration Zahl als array-index in xsl

Xml bin ich mit

"<default>"
    "<string>a</string>"
    "<string>Apple</string>"
    "<string>b</string>"
    "<string>Ball</string>"
    "<string>c</string>"
    "<string>Cat</string>"
    "<string>d</string>"
    "<string>Dog</string>"
"</default>"

and this is the xsl I am using

  <xsl:for-each select="//default/string">
        <xsl:element name="{/default/string[?]\">
             <xsl:value-of select="/default/string[?]\"/>
        </xsl:element>
  </xsl:for-each>

Nun möchte ich mein xml-Format in diesem format

<default>
   <a>Apple</a>
   <b>Ball</b>
   <c>Cat</c>
   <d>Dog</d>
</default>

Dafür brauche ich die aktuelle iteration Nummer in <xsl:element name="{/default/string[?]\"> und inkrementierten Wert in <xsl:value-of select="/default/string[?]\"/>
. Kann jemand mir helfen, in diesem?

InformationsquelleAutor Pulkit | 2013-12-02
Schreibe einen Kommentar