CMDBuild Forum

OCS Inventory Connector

You don’t need two connectors, the situation you want to achieve it’s one of the most common and it’s supported.

Probably there is a problem in the configuration. Could you also send us the transform.xsl?
 
Thanks.
CMDBuild Team

Previously Tecnoteca wrote:

You don't need two connectors, the situation you want to achieve it's one of the most common and it's supported.
Probably there is a problem in the configuration. Could you also send us the transform.xsl?
 
Thanks.
CMDBuild Team

 

Hi,
 
Thanks again for your quick response.  Please find below the contents of the transform.xsl.  I'll wait for your comments.
 
Patrick
 
<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform
version="1.0"> 
<xsl:output method="xml" version="1.0" encoding="UTF-8" 
indent="yes" /> 
<xsl:template match="/"> 
<CMDBUILD> 
<xsl:apply-templates /> 
</CMDBUILD> 
</xsl:template> 
<xsl:template match="*"> 
<xsl:apply-templates /> 
</xsl:template> 
<xsl:template match="text()"></xsl:template> 
<xsl:template match="/inventory/device"> 
<xsl:variable name="TRAM">
<xsl:choose>
<xsl:when test="string(number(sum(/inventory/memory/CAPACITY))) != 'NaN'">
<xsl:value-of select="sum(/inventory/memory/CAPACITY)" />
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="CPUSP" select="(./PROCESSORS) div 1000" />
<xsl:variable name="CPUSF">
<xsl:if test="$CPUSP != 'NaN' and $CPUSP != 0">
<xsl:value-of select="$CPUSP" />
</xsl:if>
</xsl:variable>
<xsl:variable name="PROCESSORNF">
<xsl:if test="./PROCESSORN != 'NaN' and ./PROCESSORN != 0">
<xsl:value-of select="./PROCESSORN" />
</xsl:if>
</xsl:variable>
<PC key="Code"> 
<xsl:attribute name="objid"> 
<xsl:value-of select="./@objid" /> 
</xsl:attribute> 
<Code> 
<xsl:value-of select="./TAG" /> 
</Code> 
<Description> 
<xsl:value-of select="./TAG" /> 
<xsl:text> / </xsl:text>
<xsl:value-of select="./NAME" /> 
</Description> 
<RAM>
<xsl:value-of select="$TRAM" />
</RAM>
<IPAddress> 
<xsl:value-of select="./IPADDR" /> 
</IPAddress> 
<CPUNumber> 
<xsl:value-of select="$PROCESSORNF" /> 
</CPUNumber> 
<CPUSpeed>
<xsl:value-of select="$CPUSF" /> 
</CPUSpeed> 
</PC> 
</xsl:template> 
  <xsl:template match="/CMDBUILD/PC"> 
<PC key="Code"> 
<xsl:attribute name="objid"> 
<xsl:value-of select="./@objid" /> 
</xsl:attribute> 
<Code> 
<xsl:value-of select="./Code" /> 
</Code> 
<Description> 
<xsl:value-of select="./Description" /> 
</Description> 
<RAM>
<xsl:value-of select="./RAM" />
</RAM>
<IPAddress> 
<xsl:value-of select="./IPAddress" /> 
</IPAddress> 
<CPUNumber> 
<xsl:value-of select="./CPUNumber" /> 
</CPUNumber> 
<CPUSpeed>
<xsl:value-of select="./CPUSpeed" /> 
</CPUSpeed> 
</PC> 
</xsl:template>
<xsl:template match="/inventory/monitor"> 
<xsl:variable name="MModel">
<xsl:value-of select="./MANUFACTURER" /> 
<xsl:text>: </xsl:text>
<xsl:value-of select="./CAPTION" /> 
</xsl:variable>
<xsl:variable name="MPCConnect">
<xsl:value-of select="/inventory/device/TAG" /> 
<xsl:text> / </xsl:text>
<xsl:value-of select="/inventory/device/NAME" /> 
</xsl:variable>
<Monitor domain="PcMonitor" domaindirection="directed" identifiers="Code">
<xsl:attribute name="objid"> 
<xsl:value-of select="./@objid" /> 
</xsl:attribute> 
<Code> 
<xsl:value-of select="./ID" />
</Code>
<Description> 
<xsl:value-of select="./DESCRIPTION" /> 
</Description> 
<Model> 
<xsl:value-of select="$MModel" />
</Model> 
<SerialNumber> 
<xsl:value-of select="./SERIAL" /> 
</SerialNumber> 
<PCConnect>
<xsl:value-of select="$MPCConnect" /> 
</PCConnect>
</Monitor> 
</xsl:template>
<xsl:template match="/CMDBUILD/Monitor">
<Monitor domain="PcMonitor" domaindirection="directed" identifiers="Code">
<xsl:attribute name="objid"> 
<xsl:value-of select="./@objid" /> 
</xsl:attribute> 
<Code> 
<xsl:value-of select="./Code" /> 
</Code>
<Description> 
<xsl:value-of select="./Description" /> 
</Description> 
<Model> 
<xsl:value-of select="./Model" /> 
</Model> 
<SerialNumber> 
<xsl:value-of select="./SerialNumber" /> 
</SerialNumber> 
<PCConnect>
<xsl:value-of select="./PCConnect" /> 
</PCConnect>
</Monitor> 
</xsl:template>
</xsl:stylesheet>