Rather than nested for loops, you can apply-templates and use the same template to generate files for the projectRole, issueType, and customField elements:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="projectStructure/projectElements/*/*"/>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="projectElements/*/*">
<xsl:variable name="elementname" select="name" />
<xsl:variable name="filename"
select="concat('./out/', local-name(), '_', $elementname, '.xml')" />
<xsl:result-document exclude-result-prefixes="xs" href="{$filename}">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:result-document>
</xsl:template>
</xsl:stylesheet>