This is the issue: The transformed XSLT is supposed to show two phone numbers, <Phone_1> and <Phone_2>, one for each. The Fax tag is just added for reference.
This is a snippet of the XML I have to transform:
<DirPartyContactInfoView>
<Locator>08-922100</Locator>
<Type>Phone</Type>
</DirPartyContactInfoView>
<Locator>073-6564865</Locator>
<Type>Phone</Type>
</DirPartyContactInfoView>
<Locator>08-922150</Locator>
<Type>Fax</Type>
</DirPartyContactInfoView>
And here's my current take on the XSLT for this snippet. So far I've tried setting a variable as a condition, knowing that it can only set the variable value once and not modify it.
<xsl:for-each select="DirPartyContactInfoView">
<xsl:choose>
<xsl:when test="Type='Phone'">
<xsl:variable name="Phone1" />
<xsl:choose>
<xsl:when test="Phone1=''">
<xsl:variable name="Phone1" select="Locator" />
<Phone_1>
<xsl:value-of select="Locator" />
</Phone_1>
</xsl:when>
<xsl:otherwise>
<Phone_2>
<xsl:value-of select="Locator" />
</Phone_2>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="Type='Fax'">
<Fax>
<xsl:value-of select="Locator" />
</Fax>
</xsl:when>
</xsl:choose>
</xsl:for-each>
Yet I get two <Phone_2> on the output, and I'm all out of ideas. I'm guessing I can't use a variable like this. Any way to fix this?