Hallo,
[...] und somit lerne ich es auch!
Damit es etwas automatisierter (d.h unabhängig davon wie viele Zeichen du im Element oder attribut hast) geht und beim Lernen auch eine Herausforderung da ist ;-):
Ein recursives Template:
<xsl:template name="createinputelement">
<xsl:param name="node" />
<xsl:param name="valueforfirstinput" select="substring($node,1,1)" />
<xsl:variable name="valueforrestinput" select="substring-after($node, $valueforfirstinput)" />
xsl:choose
<xsl:when test="$valueforrestinput != ''">
<input type="text" name="{concat(local-name($node), $valueforfirstinput)}" value="{$valueforfirstinput}" /><br />
<xsl:call-template name="createinputelement">
<xsl:with-param name="node" select="$node" />
<xsl:with-param name="valueforfirstinput" select="substring($valueforrestinput,1,1)" />
</xsl:call-template>
</xsl:when>
xsl:otherwise
<input type="text" name="{concat(local-name($node), $valueforfirstinput)}" value="{$valueforfirstinput}" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Das Template wird dann so aufgerufen (z.B.):
<xsl:template match="Frame">
<xsl:call-template name="createinputelement">
<xsl:with-param name="node" select="." />
</xsl:call-template>
</xsl:template>
oder so:
<xsl:for-each select="Frame">
<xsl:call-template name="createinputelement">
<xsl:with-param name="node" select="." />
</xsl:call-template>
</xsl:for-each>
Es wird (in diesem Beispiel) folgedes erzeugt:
<input type="text" name="Frame8" value="8"><br>
<input type="text" name="FrameE" value="E"><br>
<input type="text" name="Frame1" value="1">
Grüße
Thomas