Cybersecurity
DevOps Cloud
IT Operations Cloud
This article will show you how to convert a mapping table from NetIQ Identity Manager into CSV format that can be used to view the mapping table in a spreadsheet application like Excel.
This is useful when the table is so large that it doesn't fit on the screen and you need to share it with someone or you just want someone to edit it and send it back to you.
Mapping tables are usually created and edited in Designer or iManager.
They are stored in eDirectory using the "DirXML-Resource" object class.
The mapping table data itself is stored in the "DirXML-Data" attribute in XML format.
I'm using XSLT to convert from XML to CSV format.
How to write the XSLT is beyond the scope of the article.
How to use the XSLT depends on which XSLT processor you are going to use. You can e.g. use the command line Saxon-HE processor, or you might just do a web search for "xslt online" if you want to trust a website with your mapping table data.
In this example I'll be using Saxon on the command line, you can find the documentation here: https://www.saxonica.com/documentation12/index.html#!using-xsl/commandline
It assumes you know how to get Java running on your system.
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="1.0"> <xsl:output omit-xml-declaration="yes"></xsl:output> <xsl:template match="mapping-table"> <xsl:variable name="colDefs" select="col-def"></xsl:variable> <xsl:message> <xsl:value-of select="count($colDefs)"></xsl:value-of> </xsl:message> <xsl:for-each select="$colDefs"> <xsl:message> <xsl:value-of select="@name"></xsl:value-of> </xsl:message> <xsl:value-of select="@name"></xsl:value-of> <xsl:if test="position()!=last()"> <xsl:text>;</xsl:text> </xsl:if> <xsl:variable name="currPos"> <xsl:value-of select="position()"></xsl:value-of> </xsl:variable> </xsl:for-each> <xsl:text>
</xsl:text> <xsl:for-each select="//row"> <xsl:variable name="cols" select="col"></xsl:variable> <xsl:for-each select="$colDefs"> <xsl:variable name="curPos" select="position()"></xsl:variable> <xsl:value-of select="$cols[$curPos]"></xsl:value-of> <xsl:if test="position()!=last()"> <xsl:text>;</xsl:text> </xsl:if> </xsl:for-each> <xsl:text>
</xsl:text> </xsl:for-each> </xsl:template> </xsl:stylesheet>
java -jar .\saxon-he-12.4.jar -s:.\mymappingtable.xml -xsl:.\convertmappingtable.xsl -o:.\mycsvfile.csv