<xsl:stylesheet
	version="1.0" 
	xmlns:es="http://www.novell.com/nxsl/ecmascript"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	exclude-result-prefixes="es"
	>

	<!-- This is for testing the stylesheet outside of DirXML so things are pretty to look at -->
<xsl:strip-space elements="*"/>
<xsl:preserve-space elements="association add-association remove-association value component password check-password"/>
<xsl:output indent="yes" method="xml"/>

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

<!--  template that splits the splitme attribute values into multiple values -->
<xsl:template match="*[@attr-name='splitme']//value">
     <xsl:for-each select="es:split(string(.))">
	   <value>
    	  <xsl:value-of select="."/>
	   </value>
     </xsl:for-each>
</xsl:template>

<!--  template that joins the joinme attribute values into a single value -->
<xsl:template match="*[@attr-name='joinme']//*[value] | *[@attr-name='joinme'][value]">
   <xsl:copy>
      <xsl:apply-templates select="@*|node()[not(self::value)]"/>
	   <value>
    	  <xsl:value-of select="es:join(value)"/>
	   </value>
   </xsl:copy>
</xsl:template>

</xsl:stylesheet>
