I am trying to add elements with a comma and a space in `<album>` if it is not the last `<album>` within a parent `<recording>`.

I have a similar template for `<recording>`s, which works as expected. However, I cannot get the second template for the `<album>` punctuation to work correctly.

I believe it has something do to with the first template existing...

**Input XML**

```
<sample>
<collection>
    <recording>
        <artist>Radiohead</artist>
        <album>OK Computer</album>
    </recording>
    <recording>
        <artist>Tori Amos</artist>
        <album>Boys For Pele</album>
        <album>To Venus And Back</album>
    </recording>
</collection>

```

**Sample XSLT**

```
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">

<xsl:template match="node()|@*">
    <xsl:copy>
        <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="collection">
    <xsl:copy>
        <xsl:for-each select="recording">
            <xsl:copy>
                <xsl:apply-templates select="node() | @*"/>
            </xsl:copy>
            <xsl:if test="position()!=last()">
                <xsl:element name="x">, </xsl:element>
            </xsl:if>
        </xsl:for-each>
    </xsl:copy>
</xsl:template>

<xsl:template match="recording">
    <xsl:copy>
        <xsl:for-each select="album">
            <xsl:copy>
                <xsl:apply-templates select="node() | @*"/>
            </xsl:copy>
            <xsl:if test="position()!=last()">
                <comma>, </comma>
            </xsl:if>
        </xsl:for-each>
    </xsl:copy>
</xsl:template>

```

**But my output is** 

```
<sample>
<collection>
    <recording>
        <artist>Radiohead</artist>
        <album>OK Computer</album>
    </recording><x>, </x>
    <recording>
        <artist>Tori Amos</artist>
        <album>Boys For Pele</album>
        <album>To Venus And Back</album>
    </recording>
</collection>

```

**Instead of what I want** (note the `<x>`, after the first `<album>` in the second `<recording>`)

```
<sample>
    <collection>
        <recording>
            <artist>Radiohead</artist>
            <album>OK Computer</album>
        </recording><x>, </x>
        <recording>
            <artist>Tori Amos</artist>
            <album>Boys For Pele</album><x>, </x>
            <album>To Venus And Back</album>
        </recording>
    </collection>
</sample>

```