Added prerelease of KIT converter tool - debug version - outputs "invalid"...

Added prerelease of KIT converter tool - debug version - outputs "invalid" text within the produced SimModel target elements indicating either issues in ifc testmodel (e.g. expected source elements/values not present) or the mapping table as defined in ReqCap tool has issues.

Note: the "schemaLocation" of the produced Simmodel file is set relative to the schema files EnEff-BIM/EneffBIM_UseCases repository - temporary introduced valid schema in branch "OfficialSimModelSchema" in that repository until the issues described in the initial commit message of the branch is cleared. Thus please make sure to have checked it out for the use of the converter as described in the README.
parent dd76092a
@echo off
cscript Main.js //Nologo %1
/*
* ifcXML.js
*
* JScript zur zur Transformation einer Quelldatei zur designierten Zieldatei mithilfe xsl stylesheet
*/
var args = WScript.Arguments;
if (args.length == 0) {
WScript.Echo("Syntaxfehler.");
WScript.Quit();
}
// command-line argumente auslesen
filename = args(0); // Quelldatei
try {
// XML Objekt fr die Quelldatei erzeugen
var xml = new ActiveXObject("Msxml2.DOMDocument.6.0");
xml.async = false;
xml.validateOnParse = true;
xml.load(filename);
WScript.Echo("source XML load succeeded.");
// Einlesevorgang Quelldatei error handling
if (xml.parseError.errorCode != 0) {
WScript.Echo(xml.parseError.reason);
WScript.Quit()
}
// XSLT-Stylesheet laden
var xsl = new ActiveXObject("Msxml2.DOMDocument.6.0");
xsl.async = false;
xsl.resolveExternals = true; // xsl:include zulassen
xsl.setProperty("AllowXsltScript", true); // Skripte erlauben
////////////////
xsl.setProperty("AllowDocumentFunction", true); // document() Funktion erlauben
///////////////
xsl.validateOnParse = true;
xsl.load("xsl\\Main.xsl"); // "Statisch verdrahteter" Einstiegspunkt in XSLT Geflecht
WScript.Echo("XSL load succeeded.");
// Einlesevorgang XSLT error handling
if (xsl.parseError.errorCode != 0) {
WScript.Echo(xsl.parseError.reason);
WScript.Quit()
}
// Objekt fr Zieldokument erzeugen
var result = new ActiveXObject("Msxml2.DOMDocument.6.0");
// Speichere Startzeit
var sTime = new Date();
// Quelldatei TRANSFORMieren
WScript.Echo("Started Transformation.");
xml.transformNodeToObject(xsl.documentElement, result);
WScript.Echo("Transformation succeeded.");
var eTime = new Date();
var elapsed = (eTime.getTime() - sTime.getTime()) / 1000;
WScript.Echo("Transformation took " + elapsed + " seconds.");
// Zieldokument in UTF-8-Stream schreiben
var utf8Stream = new ActiveXObject("ADODB.Stream");
fso = new ActiveXObject("Scripting.FileSystemObject");
utf8Stream.Type = 2; // adTypeText
utf8Stream.Charset = "utf-8"
utf8Stream.LineSeparator = 10; // adLF
utf8Stream.Open();
utf8Stream.WriteText(result.xml);
utf8Stream.Position = 3; // Byte Order Mark berspringen
utf8Stream.SaveToFile("output\\" + fso.GetBaseName(filename) + ".simxml", 2); // adSaveCreateOverWrite
WScript.Echo("Transformation result saved to OUTPUT folder.");
utf8Stream.Close();
}
catch (err) {
WScript.Echo(err.description);
}
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-Stylesheet to Generate a List of all Properies and a List of duplicate Properties -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="xsl ifc msxsl">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template name="GenerateDuplicateList">
<xsl:param name="PSByRelDef"/>
<xsl:param name="PSByType"/>
<!--CASE 1: Properties are directly referenced-->
<xsl:for-each select="msxsl:node-set($PSByType)/ifc:IfcPropertySet/ifc:HasProperties/ifc:IfcPropertySingleValue">
<xsl:variable name="Name" select="@Name"/>
<xsl:variable name="psetName" select="../../@Name"/>
<xsl:variable name="psetGlobalID" select="../../@GlobalId"/>
<xsl:for-each select="msxsl:node-set($PSByRelDef)/ifc:IfcPropertySet/ifc:HasProperties/ifc:IfcPropertySingleValue">
<xsl:variable name="RelDefPropertyName" select="@Name"/>
<xsl:variable name="RelDefPropertySetName" select="../../@Name"/>
<xsl:if test="current()[contains(../../@Name, $psetName)]">
<xsl:if test="$Name = $RelDefPropertyName">
<xsl:text>
</xsl:text>
<xsl:value-of select="$psetGlobalID"/>:<xsl:value-of select="$psetName"/>:<xsl:value-of select="$Name"/>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
<!--CASE 2: Properties are defined by relation-->
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template name="ConcatPsetCollections">
<xsl:param name="PSByRelDef"/>
<xsl:param name="PSByType"/>
<xsl:copy-of select="$PSByRelDef"/>
<xsl:copy-of select="$PSByType"/>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?>
<!-- KIT Tool | EneffBIM converter (Author KIT BLM 2015)-->
<!-- XSLT-Stylesheet Transformation from IfcBoiler to the aquivalent SimModel type -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" exclude-result-prefixes="xsl ifc">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!--the IfcBoiler template-->
<xsl:template match="ifc:IfcBoiler">
<xsl:param name="KeyPool"/>
<xsl:if test="$KeyPool != ''">
<xsl:variable name="simelemname">
<xsl:call-template name="getSimElementName">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="targetelements">
<!--<xsl:element name="simcore:SimUniqueID">TTT</xsl:element>-->
<!-- generate current's target elements specific fields and attributes (e.g. UniqueId)-->
<!--<xsl:copy>-->
<xsl:call-template name="resolvekeypool">
<xsl:with-param name="KeyPoolSnippet" select="$KeyPool"/>
<xsl:with-param name="elemname" select="'name'"/>
</xsl:call-template><!--</xsl:copy>-->
</xsl:variable>
<!--Call the Generic Generation Template-->
<xsl:call-template name="GenerateIfcElement">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
<xsl:with-param name="simelemname" select="$simelemname"/>
<xsl:with-param name="pregens" select="$targetelements"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-Stylesheet Transformation of the ifcBoiler type to the SimModel aquivalent Type-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" exclude-result-prefixes="xsl ifc">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!--the IfcBoiler template-->
<xsl:template match="ifc:IfcBuilding" name="GetIfcBuilding" mode="traverse">
<!--Check wether matched Boiler is instance (else ignore reference object with @ref="...")-->
<xsl:if test="current()[@GlobalId]">
<!--@id -> This is misplaced: here only generation - eval wether id/ref (or Tag/ObjectType) should not take place here -> because by calling template current() is implicitly transfered and the attributes are commonly inherited from base class (so the resolving templates e.g. IfcType can check them uniformly)-->
<xsl:for-each select=".">
<!--<xsl:element name="SimBuilding">-->
<!--<xsl:value-of select="$KeyPool"/>-->
<xsl:if test="current()/ifc:IsDecomposedBy/ifc:IfcRelAggregates/ifc:RelatedObjects != ''">
<!--<xsl:variable name="BuildRelatedObjects" select="current()/ifc:IsDecomposedBy/ifc:IfcRelAggregates/ifc:RelatedObjects"/>
<xsl:for-each select="$BuildRelatedObjects/ifc:IfcBuildingStorey">
<xsl:call-template name="GetIfcBuildingStorey">
</xsl:call-template>
</xsl:for-each>-->
<xsl:for-each select="current()/ifc:IsDecomposedBy/ifc:IfcRelAggregates/ifc:RelatedObjects/node()">
<xsl:apply-templates select="current()" mode="traverse"/>
</xsl:for-each>
</xsl:if>
<!--</xsl:element>-->
</xsl:for-each>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-Stylesheet Transformation of the IfcBuildingStory type to the SimModel aquivalent Type-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="xsl ifc msxsl">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!--the IfcBuildingStory template-->
<xsl:template match="ifc:IfcBuildingStorey" name="GetIfcBuildingStorey" mode="traverse">
<!--Check wether matched IfcBuildingStory is instance (else ignore reference object with @ref="...")-->
<xsl:choose>
<xsl:when test="current()[@GlobalId]">
<xsl:for-each select=".">
<xsl:if test="current()/ifc:ContainsElements/ifc:IfcRelContainedInSpatialStructure/ifc:RelatedElements">
<xsl:for-each select="current()/ifc:ContainsElements/ifc:IfcRelContainedInSpatialStructure/ifc:RelatedElements/node()">
<!--<xsl:call-template name="KeyPoolHelper">
<xsl:with-param name="currentElement" select="name()"/>
</xsl:call-template>-->
<xsl:copy-of select="current()"/>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:when test="current()/@ref">
<xsl:variable name="refid" select="current()/@ref"/>
<!--CASE 2 (ref-id): NOT NESTED-->
<xsl:for-each select="msxsl:node-set($allsourceobjects)/descendant::ifc:IfcBuildingStorey"><!--//*/ifc:IfcBuildingStorey-->
<xsl:if test="current()[contains(@id,$refid)]">
<!--a recursive "self-call" would be quite nice here ;) for now copied from above, thus redundant -->
<xsl:if test="current()[@GlobalId]">
<xsl:for-each select=".">
<xsl:if test="current()/ifc:ContainsElements/ifc:IfcRelContainedInSpatialStructure/ifc:RelatedElements">
<!--TODO refId-->
<!--<xsl:variable name="BuildRelatedObjects" select="current()/ifc:ContainsElements/ifc:IfcRelContainedInSpatialStructure/ifc:RelatedElements"/>
<xsl:for-each select="$BuildRelatedObjects">
<xsl:copy-of select="node()"/>
</xsl:for-each>-->
<xsl:for-each select="current()/ifc:ContainsElements/ifc:IfcRelContainedInSpatialStructure/ifc:RelatedElements/node()">
<xsl:copy-of select="current()"/>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-Stylesheet Transformation from IfcBuildingSystem to the aquivalent SimModel type-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="xsl ifc">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!--the IfcBuildingSystem template-->
<xsl:template match="ifc:IfcBuildingSystem">
<xsl:param name="KeyPool"/>
<xsl:if test="$KeyPool != ''">
<xsl:variable name="simelemname">
<xsl:call-template name="getSimElementName">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
</xsl:call-template>
</xsl:variable>
<!--Call the Generic Generation Template-->
<xsl:call-template name="GenerateIfcElement">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
<xsl:with-param name="simelemname" select="$simelemname"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-Stylesheet Transformation from IfcDistributionPort to the aquivalent SimModel type-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="xsl ifc msxsl">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!--the IfcDistributionPort template-->
<xsl:template match="ifc:IfcDistributionPort">
<xsl:param name="KeyPool"/>
<xsl:if test="$KeyPool != ''">
<xsl:variable name="simelemname">
<xsl:call-template name="getSimElementName">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
</xsl:call-template>
</xsl:variable>
<!--pregenerate target objects elements -->
<xsl:variable name="targetelements">
<!-- generate current's target elements specific fields and attributes (e.g. UniqueId)-->
<!--<xsl:copy>-->
<xsl:call-template name="resolvekeypool">
<xsl:with-param name="KeyPoolSnippet" select="$KeyPool"/>
<xsl:with-param name="elemname" select="'name'"/>
</xsl:call-template><!--</xsl:copy>-->
<!--<xsl:for-each select=".">-->
<xsl:variable name="portid">
<xsl:copy>
<xsl:value-of select="@id"/>
</xsl:copy>
</xsl:variable>
<!--<xsl:value-of select="$portid"/>-->
<!--DEPRECIATED AS DEFAULT IN IFC4-->
<!--RESOLVE IfcRelConnectsPortToElement objectified assosation & GENERATE simres:HostElement target element-->
<!--<xsl:for-each select="msxsl:node-set($allsourceobjects)/descendant::ifc:IfcRelConnectsPortToElement">
--><!--//*/ifc:IfcRelConnectsPortToElement--><!--
<xsl:if test="current()/ifc:RelatingPort[@ref = $portid]">
<xsl:variable name="elemid">
<xsl:copy>
<xsl:value-of select="current()/ifc:RelatedElement/@ref"/>
</xsl:copy>
</xsl:variable>
--><!--<xsl:value-of select="$elemid"/>--><!--
--><!--add the property "simres:HostElement" with the RefID (ID + Ifc global ID) of the designated Element of the port--><!--
<xsl:element name="simres:HostElement">
<xsl:for-each select="msxsl:node-set($allsourceobjects)/node()">
--><!--//*/node()--><!--
--><!--/ifc:ifcXML/node() $portCollection distinct-nodes($portCollection)--><!--
<xsl:if test="current()[@id = $elemid]">ID<xsl:value-of select="current()/@GlobalId"/>
</xsl:if>
</xsl:for-each>
</xsl:element>
</xsl:if>
</xsl:for-each>-->
<!--IFC4 NEW DEFAULT: PORTS are nested within elements (e.g. Boiler)-->
<!--NOTE: now ports can be declared in object type aswell; assumption (needs clarification!): objects occurrance port overwrites object type port if conflicting ?!-->
<!--NESTED STRUCTURE:-->
<!--1 wanted IfcElement (or type; this case has to be discussed though!)-->
<!--2 <IsNestedBy>
3 <IfcRelNests>
4 <RelatedObjects>-->
<!--5 current nesting level (port collection)-->
<!--<xsl:for-each select="../../../../.">
<xsl:if test="current()[@GlobalId]">
<xsl:choose>
--><!--since ports are nested: check if parent is object's type OR occurance--><!--
<xsl:when test="contains(name(), 'Type')">ERROR! Not handled conversion from ports defined by object type, add port instance to object occurance.</xsl:when>
<xsl:otherwise>
--><!--add the property "simres:HostElement" with the RefID (ID + Ifc global ID) of the designated Element of the port--><!--
<xsl:element name="simres:HostElement">ID<xsl:value-of select="@GlobalId"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>-->
<!--sample instance from jun's target file-->
<!-- water inlet port attached into the boiler -->
<!--<SimDistributionPort_HotWaterFlowPort_Water_In RefId="ID51521">
<simres:SimUniqueID>b00a71f1-b1f9-45f3-91ec-ef8ddabc7bb1</simres:SimUniqueID>
<simres:SimModelType>HotWaterFlowPort</simres:SimModelType>
<simres:SimModelSubtype>Water_In</simres:SimModelSubtype>
<simres:SimModelName>HWI-1(2)(2)</simres:SimModelName>
<simres:SourceModelSchema>Simergy v1.0.704.14225</simres:SourceModelSchema>
<simres:HostElement>ID28397</simres:HostElement>
</SimDistributionPort_HotWaterFlowPort_Water_In>-->
<!-- water outlet port attached into the boiler -->
<!-- <SimDistributionPort_HotWaterFlowPort_Water_Out RefId="ID31719">
<simres:SimUniqueID>10dbdb84-7552-4c5b-a959-60c5779183bb</simres:SimUniqueID>
<simres:SimModelType>HotWaterFlowPort</simres:SimModelType>
<simres:SimModelSubtype>Water_Out</simres:SimModelSubtype>
<simres:SimModelName>HWO-1(1)(4)</simres:SimModelName>
<simres:SourceModelSchema>Simergy v1.0.704.14225</simres:SourceModelSchema>
<simres:HostElement>ID28397</simres:HostElement>
</SimDistributionPort_HotWaterFlowPort_Water_Out>-->
<!--</xsl:element>-->
<!--</xsl:for-each>-->
</xsl:variable>
<!--Call the Generic Generation Template-->
<xsl:call-template name="GenerateIfcElement">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
<xsl:with-param name="simelemname" select="$simelemname"/>
<xsl:with-param name="pregens" select="$targetelements"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!--<xsl:template name="IfcRelConnectsPortToElement"/>-->
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-Stylesheet Transformation from IfcDistributionSystem to the aquivalent SimModel type-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="xsl ifc">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!--the IfcDistributionSystem template-->
<xsl:template match="ifc:IfcDistributionSystem">
<xsl:param name="KeyPool"/>
<xsl:if test="$KeyPool != ''">
<xsl:variable name="simelemname">
<xsl:call-template name="getSimElementName">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
</xsl:call-template>
</xsl:variable>
<!--Call the Generic Generation Template-->
<xsl:call-template name="GenerateIfcElement">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
<xsl:with-param name="simelemname" select="$simelemname"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-Stylesheet Transformation from ifcBoiler to the aquivalent SimModel type-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="xsl ifc msxsl">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- testwise: Gather needed source entity collections (object occurance/type, "decoupled" root element children and combine them in one iterable "source entities collection") -->
<xsl:variable name="sourceobjects">
<!--traverse down "IfcProject" object occurance to where the elements collection reside in spacial objects as IfcBuildingStorey and ultimativly (obligatory for EnEff-BIM compatible models) in IfcSpaces Note: the templates down that nesting are hard coded (IfcProj calls IfcSite and so on) while all possible alternative (mainly realised in instance with ID7REF) are successivly added to the single templates (e.g. all ifc element instances can also reside as root element child -> thus this has to be taken into account-->
<!--precheck nested object occurance-->
<!--<xsl:if test="/ifc:ifcXML/ifc:IfcProject/ifc:IsDecomposedBy | /ifc:ifcXML/ifc:IfcProject/ifc:Declares">-->
<xsl:for-each select="/ifc:ifcXML/ifc:IfcProject">
<xsl:if test="current()/ifc:IsDecomposedBy | current()/ifc:Declares">
<xsl:call-template name="IfcProject"/>
</xsl:if>
</xsl:for-each>
<!--</xsl:if>-->
</xsl:variable>
<xsl:variable name="rootchildren">
<xsl:for-each select="/ifc:ifcXML/node()">
<xsl:if test="not(contains(name(), 'IfcProject'))">
<xsl:copy-of select="current()"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="allsourceobjects">
<xsl:copy-of select="$sourceobjects"/>
<xsl:copy-of select="$rootchildren"/>
</xsl:variable>
<xsl:template name="IterateAllSourceObjects">
<!--DEBUG-->
<!--<xsl:element name="SimActor_Actor_Default">
<xsl:copy-of select="$allsourceobjects"/>
</xsl:element>-->
<!--DEBUG-->
<xsl:for-each select="msxsl:node-set($allsourceobjects)/node()">
<!--DEBUG-->
<!--<xsl:element name="SimActor_Actor_Default">
<xsl:copy-of select="current()"/>
</xsl:element>-->
<!--DEBUG-->
<!-- NEW in IFC4: extension needed to resolve nested IfcDistributionPorts within IfcBoiler, IfcPump etc.-->
<xsl:if test="current()/ifc:IsNestedBy">
<xsl:if test="current()/ifc:IsNestedBy/ifc:IfcRelNests/ifc:RelatedObjects/ifc:IfcDistributionPort">
<!--<xsl:apply-templates select="current()/IsNestedBy/IfcRelNests/RelatedObjects/ifc:IfcDistributionPort"/>-->
<xsl:for-each select="current()/ifc:IsNestedBy/ifc:IfcRelNests/ifc:RelatedObjects/ifc:IfcDistributionPort">
<xsl:call-template name="KeyPoolHelper">
<xsl:with-param name="currentElement" select="name()"/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
</xsl:if>
<xsl:call-template name="KeyPoolHelper">
<xsl:with-param name="currentElement" select="name()"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="GenerateIfcElement">
<xsl:param name="KeyPool"/>
<xsl:param name="simelemname"/>
<xsl:param name="pregens"/>
<xsl:param name="preEvaluation"/>
<!--Check wether IfcElement is instance (else ignore reference object with @ref="...")-->
<xsl:if test="current()[@GlobalId] or $preEvaluation != ''">
<xsl:for-each select=".">
<!--<xsl:copy-of select="current()"/>-->
<!--case 1: gather psets connected via IFC Type-->
<xsl:variable name="PropertySetsByType">
<xsl:call-template name="IfcType"/>
</xsl:variable>
<!--Debug<xsl:copy-of select="$PropertySetsByType"/>-->
<!--case 2: gather psets connected via RelDefByProperties-->
<xsl:variable name="PropertySetsByRelDefBy">
<xsl:call-template name="ResolveIfcRelDefinesByProperties"/>
</xsl:variable>
<!--Debug<xsl:copy-of select="$PropertySetsByRelDefBy"/>-->
<!--combine ALL possible PSets to current source object (concat(PropertySetsByType, PropertySetsByRelDefBy)-->
<xsl:variable name="ConcatedPsetCollections">
<xsl:call-template name="ConcatPsetCollections">
<xsl:with-param name="PSByRelDef" select="$PropertySetsByRelDefBy"/>
<xsl:with-param name="PSByType" select="$PropertySetsByType"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="DuplicateList">
<xsl:call-template name="GenerateDuplicateList">
<xsl:with-param name="PSByRelDef" select="$PropertySetsByRelDefBy"/>
<xsl:with-param name="PSByType" select="$PropertySetsByType"/>
</xsl:call-template>
</xsl:variable>
<!--Debug<xsl:value-of select="$elemid"/>-->
<xsl:choose>
<xsl:when test="$preEvaluation != ''">
<xsl:call-template name="IterateAlongSequenceOrder">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
<xsl:with-param name="UnsortedList" select="$ConcatedPsetCollections"/>
<xsl:with-param name="DuplicateList" select="$DuplicateList"/>
<xsl:with-param name="preEvaluation" select="$preEvaluation"/>
<xsl:with-param name="pregens" select="$pregens"/>
</xsl:call-template>
<!--<xsl:copy-of select="current()"/>-->
</xsl:when>
<xsl:otherwise>
<!--GENERATE the target element-->
<!--<SimFlowPlant_Boiler_BoilerHotWater>-->
<xsl:element name="{$simelemname}">
<!--DEBUG-->
<!--<xsl:copy-of select="$KeyPool"/>-->
<!--<xsl:element name="ConcatedPsetCollections">
<xsl:copy-of select="$ConcatedPsetCollections"/>
</xsl:element>-->
<!--<xsl:element name="DuplicateList">
<xsl:copy-of select="$DuplicateList"/>
</xsl:element> -->
<!--generate the only xml attribute-->
<xsl:attribute name="RefId"><xsl:call-template name="TargetValueFormatConditions"><!--Here is where the ID-Generator has to go --><xsl:with-param name="sourcename"><xsl:value-of select="'GlobalId'"/></xsl:with-param><xsl:with-param name="sourcevalue"><xsl:value-of select="@GlobalId"/></xsl:with-param></xsl:call-template></xsl:attribute>
<!--concat('ID',@GlobalId)-->
<!--employ the SimXsdRepository with the combined pset collection from the source model
after checking the existance of the handed in pset/properties in the mapping table they are generated and added to result tree in correct (schema-conform) order-->
<!--<xsl:value-of select="$KeyPool"/>-->
<xsl:call-template name="IterateAlongSequenceOrder">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
<xsl:with-param name="CurrentSimElementName" select="$simelemname"/>
<xsl:with-param name="UnsortedList" select="$ConcatedPsetCollections"/>
<xsl:with-param name="DuplicateList" select="$DuplicateList"/>
<xsl:with-param name="pregens" select="$pregens"/>
</xsl:call-template>
<!--<xsl:if test="$pregens != ''">
<xsl:copy-of select="$pregens"/>
</xsl:if>-->
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="TargetValueFormatConditions">
<xsl:param name="sourcename"/>
<xsl:param name="sourcevalue"/>
<xsl:param name="targetname"/>
<xsl:variable name="addedvalue">
<xsl:if test="$sourcename = 'GlobalId'">
<xsl:value-of select="concat('ID',$sourcevalue)"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="not(contains($targetname,'UniqueID'))">
<xsl:call-template name="remove">
<xsl:with-param name="input">
<xsl:value-of select="$addedvalue"/>
</xsl:with-param>
<xsl:with-param name="removal" select="'$'"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$addedvalue"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-Stylesheet Transformation from IfcPipeFitting to the aquivalent SimModel type-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="xsl ifc">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!--the IfcPipeFitting template-->
<xsl:template match="ifc:IfcPipeFitting">
<xsl:param name="KeyPool"/>
<xsl:if test="$KeyPool != ''">
<xsl:variable name="simelemname">
<xsl:call-template name="getSimElementName">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
</xsl:call-template>
</xsl:variable>
<!-- generate current's target elements specific fields and attributes (e.g. UniqueId)-->
<!--<xsl:copy>-->
<xsl:call-template name="resolvekeypool">
<xsl:with-param name="KeyPoolSnippet" select="$KeyPool"/>
<xsl:with-param name="elemname" select="'name'"/>
</xsl:call-template><!--</xsl:copy>-->
<!--<xsl:for-each select=".">-->emplate>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-Stylesheet Transformation from IfcPipeSegment to the aquivalent SimModel type-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="xsl ifc msxsl">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!--the IfcPipeSegment template-->
<xsl:template match="ifc:IfcPipeSegment">
<xsl:param name="KeyPool"/>
<xsl:if test="$KeyPool != ''">
<xsl:variable name="simelemname">
<xsl:call-template name="getSimElementName">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="targetelements">
<!--<xsl:element name="simcore:SimUniqueID">TTT</xsl:element>-->
<!-- generate current's target elements specific fields and attributes (e.g. UniqueId)-->
<!--<xsl:copy>-->
<xsl:call-template name="resolvekeypool">
<xsl:with-param name="KeyPoolSnippet" select="$KeyPool"/>
<xsl:with-param name="elemname" select="'name'"/>
</xsl:call-template><!--</xsl:copy>-->
</xsl:variable>
<!--Call the Generic Generation Template-->
<xsl:call-template name="GenerateIfcElement">
<xsl:with-param name="KeyPool" select="$KeyPool"/>
<xsl:with-param name="simelemname" select="$simelemname"/>
<xsl:with-param name="pregens" select="$targetelements"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- XSLT-Stylesheet Transformation of the ifcBoiler type to the SimModel aquivalent Type-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.lbl.gov/namespaces/Sim/Model" xmlns:simcore="http://www.lbl.gov/namespaces/Sim/SimModelCore" xmlns:simres="http://www.lbl.gov/namespaces/Sim/ResourcesGeneral" xmlns:simgeom="http://www.lbl.gov/namespaces/Sim/ResourcesGeometry" xmlns:simbldg="http://www.lbl.gov/namespaces/Sim/BuildingModel" xmlns:simmep="http://www.lbl.gov/namespaces/Sim/MepModel" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" exclude-result-prefixes="xsl ifc">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template name="IfcProject" match=