:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="EmptyElements" priority="5">
<xsl:copy>
<xsl:apply-templates mode="enumerate" select=
"../*[not(self::EmptyElements) and not(node())]" />
</xsl:copy>
</xsl:template>
<xsl:template match="Songs/Song/*" mode="enumerate">
<xsl:value-of select="substring(',', not(position() = 1), 1)"/>
<xsl:value-of select="name()"/>
</xsl:template>
<xsl:template match="Songs/Song/*[not(node())]"/>
</xsl:stylesheet>
XML-:
<Root>
<FirstName>Bob</FirstName>
<LastName>Marley</LastName>
<ID>BM1234</ID>
<Songs>
<Song>
<EmptyElements></EmptyElements>
<SongName>No woman no cry</SongName>
<Year>1974</Year>
<album></album>
<studio></studio>
<rating></rating>
</Song>
</Songs>
</Root>
, :
<Root>
<FirstName>Bob</FirstName>
<LastName>Marley</LastName>
<ID>BM1234</ID>
<Songs>
<Song>
<EmptyElements>album,studio,rating</EmptyElements>
<SongName>No woman no cry</SongName>
<Year>1974</Year>
</Song>
</Songs>
</Root>
- , , node "as-is"
Songs/Song/*[not(node())], , , "" ( ) node .EmptyElements , , EmptyElements.EmptyElements , () enumerate siblings-.- ,
enumerate Song, Songs. <xsl:apply-templates> 4. EmptyElements. : a) , node node -list; b) . - EmptyElements, .
,
, Or simply:
, .
, , , Or simply: -answer, , , . . Or simply: -:

Or simply: - - . :
<xsl:if test="position()!=last()">
<xsl:text>, </xsl:text>
</xsl:if>
, :
not(position() = 1)
. Dr. , " ", , , :
"? , , last() : - . " position() ne last()" , , , 1.
, , ( ).
:
, - : "Or simply:", , ...