Copy only owner users

Previous Next

This help topic contains XSL sample code that you can use in USoft Delivery manager as added XSL or when calling the Apply custom XSL action.

 

Purpose

This sample removes, from an XML data file with USoft Authorizer data, all users that are not owner of at least 1 Application.

A functional reason for this may be that, as a principle, you deliver owner users from Development through XML, but that all non-owner users are defined locally in the target environments.

 

Technical notes

The first template affects all T_AUTH_USER records. It does the same as the default copy template at the end, but only for users that are registered elsewhere in the XML file as owners. For non-owner users, it does nothing: these users are skipped.

The default copy template at the end is necessary to copy all the remaining input data to the output data.

 

Sample code

 

<?xml version="1.0" encoding="windows-1252"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no"/>
 
  <!-- get only owner users -->
 
  <xsl:template match="T_AUTH_USER">
  <xsl:if test="/*/Applications/T_AUTH_APPLICATION[@OWNER_NAME=current()/@USERNAME]">
    <xsl:copy>
      <xsl:apply-templates select="*|@*|text()|comment()|processing-instruction()"/>
    </xsl:copy>   
  </xsl:template>
 
  <!--  default copy template -->
 
  <xsl:template match="*|@*|comment()|processing-instruction()|text()">
    <xsl:copy>
      <xsl:apply-templates select="*|@*|text()|comment()|processing-instruction()"/>
    </xsl:copy>
  </xsl:template>
 
</xsl:stylesheet>

 

See Also

XSL sample code