THANK YOU SO MUCH!
I followed your advice and was able to cleanup some mistake. My XSLT look
alot cleaner.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg" xmlns:rx="http://www.renderx.com/XSL/Extensions">
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="delim" select="','" />
<xsl:param name="quote" select="'"'" />
<xsl:param name="break" select="'
'" />
<xsl:template match="/">
<xsl:apply-templates select="/DataElementsList/DataElement" />
</xsl:template>
<xsl:template match="DataElement">
<xsl:apply-templates select="*" />
<xsl:if test="following-sibling::*">
<xsl:value-of select="$break" />
</xsl:if>
</xsl:template>
<xsl:template match="ConceptualDomain">
<xsl:apply-templates select="*" />
<xsl:if test="following-sibling::*">
<xsl:value-of select="$break" />
</xsl:if>
</xsl:template>
<xsl:template match="ObjectClass">
<xsl:apply-templates select="*" />
<xsl:if test="following-sibling::*">
<xsl:value-of select="$break" />
</xsl:if>
</xsl:template>
<xsl:template match="*" >
<xsl:apply-templates select="*" />
<!-- remove normalize-space() if you want keep white-space at it is -->
<xsl:value-of select="concat($quote, normalize-space(), $quote)" />
<xsl:if test="following-sibling::*">
<xsl:value-of select="$delim" />
</xsl:if>
</xsl:template>
<xsl:template match="text()" />
</xsl:stylesheet>
The element bundling problem now has been gone.
I am having another problem. The output elements especially the one which are generated from 3 or 4 levels below their parent elements sometime repeat them self ( please see output below ). It start good and end with duplicate values which got bundled together.
"C25190***","Person","2202486","NCI","NCI Thesaurus","NCI_CONCEPT_CODE","No","1""C25190*** Person 2202486 NCI NCI Thesaurus NCI_CONCEPT_CODE No 1",
I tried to add piece by piece but cannot solve this problem.