While I'm waiting for you to respond to my question above, here's an XSLT that does what you seem to be trying to do:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="@*">
<xsl:value-of select="concat(name(), ' = ', ., '
')"/>
</xsl:template>
<xsl:template match="/">
<xsl:call-template name="repeatable" >
<xsl:with-param name="limit" select="10" />
</xsl:call-template>
</xsl:template>
<xsl:template name="repeatable">
<xsl:param name="index" select="1" />
<xsl:param name="limit" select="1" />
<xsl:param name="current" select="." />
<xsl:apply-templates select="$current/@*" />
<xsl:if test="($limit >= $index)">
<xsl:call-template name="repeatable">
<xsl:with-param name="index" select="$index + 1" />
<xsl:with-param name="limit" select="$limit" />
<xsl:with-param name="current" select="$current/*" />
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
When this is run on the following input:
<root a1="a" a2="b">
<cont a3="c" a4="d">
<child a5="e" a6="f" />
</cont>
<cont a7="g" a8="h">
<child a9="i" a10="j">
<subchild a11="k" a12="l" />
</child>
</cont>
</root>
The result is:
a1 = a
a2 = b
a3 = c
a4 = d
a7 = g
a8 = h
a5 = e
a6 = f
a9 = i
a10 = j
a11 = k
a12 = l
Is that close to what you are trying to do? If not, please clarify.