I have a list of customer Information and Sales in Filemaker. I want to export it using XSL. The outcome should be something like this:

Customer "1"
Order "1" (current ordernr) (Order Nr 1)
order position "1" (Item 1)
order position "2" (Item 2)

Order "2" (current ordernr) (Order Nr 2)
order position "1" (Item 3)
order position "2" (Item 4)

and so on...
I have the coding I could attach it somehow but everything works fine until the order position, it simply does not want to display the sale position in that order that i want. I have tried with position() too. Under the order i have the following code:

`<xsl:for-each select="fm:KundenNr/fm: DATA"><xsl:variable name="pos" select="position()"/>
<xsl:variable name="var_KundenNr" select="../../fm:KundenNr/fm: DATA[$pos]"/>
<xsl:if test= "$var_KundenNr !=''">
<xsl:attribute name="LaufendeBestellungsnummer"><xsl:value-of select="$pos"/> </xsl:attribute>`

That works fine but below i tried a similar approach and I simply cannot get it in line and i have the following code:

<xsl:for-each select="../../fm:BestellNr/fm: DATA">
<xsl:variable name="Bestell_pos" select="position()"/>
<xsl:variable name="var_BestellNr" select="../../fm:BestellNr /fm: DATA[$Bestell_pos]"/><xsl:if test= "$var_BestellNr = $Bestell_Nr">`
<xsl:attribute name="LaufendePositionsnummer"><xsl:value-of select="$pos"(What do I input in here?)/></xsl:attribute>`

I need help. I am so stuck with it...