Application Delivery Management
Application Modernization & Connectivity
CyberRes
IT Operations Management
<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:cmd="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.XdsCommandProcessor" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="srcCommandProcessor"/>
<!-- change the following line to change the delimiter from a comma to any other desired delimiter -->
<xsl:variable name="delimiter" select="','"/>
<xsl:template match="nds[input]">
<!-- only look at <add> events and <instances> apply a template for each add transaction-->
<xsl:apply-templates select="//add|//instance"/>
</xsl:template>
<xsl:template match="nds[output]">
<xsl:copy-of select="."/>
</xsl:template>
<!-- now here's the template -->
<xsl:template match="input/add|input/instance">
<!-- output the fields in order -->
<xsl:call-template name="output-field">
<xsl:with-param name="field-value" select="*[(@attr-name = 'uid')][1]/value[1]"/>
</xsl:call-template>
<xsl:value-of select="$delimiter"/>
<xsl:call-template name="output-field">
<xsl:with-param name="field-value" select="*[(@attr-name = 'name')][1]/value[1]"/>
</xsl:call-template>
<xsl:value-of select="$delimiter"/>
<xsl:call-template name="output-field">
<xsl:with-param name="field-value" select="*[(@attr-name = 'role')][1]/value[1]"/>
</xsl:call-template>
<!-- finish the record with a newline -->
<!-- uncomment next line to have DOS style end of line (0D0A), otherwise just 0A -->
<!-- <xsl:value-of select="' '"/> -->
<xsl:value-of select="' '"/>
</xsl:template>
<xsl:template name="output-field">
<xsl:param name="field-value"/>
<xsl:text>"</xsl:text>
<xsl:value-of select="$field-value"/>
<xsl:text>"</xsl:text>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?><nds dtdversion="3.5" ndsversion="8.x">
<source>
<product version="?.?.?.?">DirXML</product>
<contact>Novell, Inc.</contact>
</source>
<input>
<instance class-name="User">
<attr attr-name="uid">
<value type="string">user01</value>
</attr>
<attr attr-name="name">
<value type="string">User name</value>
</attr>
<attr attr-name="role">
<value type="string">none</value>
</attr>
</instance>
</input>
</nds>
"user01","User name","none"
User name","ADMIN"<CRLF>"admin",Administrator Name
<nds dtdversion="3.5" ndsversion="8.x">
<source>
<product version="3.6.10.4747">DirXML</product>
<contact>Novell, Inc.</contact>
</source>
<input>
<instance class-name="User">
<attr attr-name="uid">
<value type="string">user01</value>
</attr>
<attr attr-name="name">
<value type="string">User name","ADMIN"
"admin","Administrator Name</value>
</attr>
<attr attr-name="role">
<value type="string">none</value>
</attr>
</instance>
</input>
</nds>
"user01","User name","ADMIN"
"admin","Administrator Name","none"
<nds dtdversion="3.5" ndsversion="8.x">
<source>
<product version="3.6.10.4747">DirXML</product>
<contact>Novell, Inc.</contact>
</source>
<input>
<instance class-name="User">
<attr attr-name="uid">
<value type="string">user01</value>
</attr>
<attr attr-name="name">
<value type="string">User name","ADMIN</value>
</attr>
<attr attr-name="role">
<value type="string">none</value>
</attr>
</instance>
</input>
</nds>
"user01","User name","ADMIN","none"
<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="2.0" xmlns:cmd="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.XdsCommandProcessor" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*" />
<xsl:param name="srcCommandProcessor"/>
<!-- change the following line to change the delimiter from a comma to any other desired delimiter -->
<xsl:variable name="delimiter" select="','"/>
<xsl:template match="nds[input]">
<!-- only look at <add> events and <instances> apply a template for each add transaction-->
<xsl:apply-templates select="//add|//instance"/>
</xsl:template>
<xsl:template match="nds[output]">
<xsl:copy-of select="."/>
</xsl:template>
<!-- now here's the template -->
<xsl:template match="input/add|input/instance">
<!-- output the fields in order -->
<xsl:call-template name="output-field">
<xsl:with-param name="field-value" select="*[(@attr-name = 'uid')][1]/value[1]"/>
</xsl:call-template>
<xsl:value-of select="$delimiter"/>
<xsl:call-template name="output-field">
<xsl:with-param name="field-value" select="*[(@attr-name = 'name')][1]/value[1]"/>
</xsl:call-template>
<xsl:value-of select="$delimiter"/>
<xsl:call-template name="output-field">
<xsl:with-param name="field-value" select="*[(@attr-name = 'role')][1]/value[1]"/>
</xsl:call-template>
<!-- finish the record with a newline -->
<!-- uncomment next line to have DOS style end of line (0D0A), otherwise just 0A -->
<!-- <xsl:value-of select="' '"/> -->
<xsl:value-of select="' '"/>
</xsl:template>
<xsl:template name="output-field">
<xsl:param name="field-value"/>
<xsl:text>"</xsl:text>
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$field-value" />
<xsl:with-param name="replace" select="' '" />
<xsl:with-param name="by" select="''" />
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="replace" select="'"'" />
<xsl:with-param name="by" select="'""'" />
</xsl:call-template>
<xsl:text>"</xsl:text>
</xsl:template>
<!-- from http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx -->
<xsl:template name="string-replace-all">
<xsl:param name="text" />
<xsl:param name="replace" />
<xsl:param name="by" />
<xsl:choose>
<xsl:when test="contains($text, $replace)">
<xsl:value-of select="substring-before($text,$replace)" />
<xsl:value-of select="$by" />
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text"
select="substring-after($text,$replace)" />
<xsl:with-param name="replace" select="$replace" />
<xsl:with-param name="by" select="$by" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>