Files
2025-12-15 23:22:33 +08:00

459 lines
12 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
As loading a local file with included local ressources now result in CORS errors,
one has to set up a local server to perform local testing.
To set up this local server (one of many ways), one has to be placed in the directory including all ressources,
i.e., all XML files and this associated XSL, then, run "python -m http.server", open Firefox or Chrome, and finally access
the files from http://localhost:8000.
For more information, see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSRequestNotHttp.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes" version="4.0"/>
<xsl:template match="ModelFile">
<html>
<head>
<script type="text/javascript">
<xsl:text>
function showHide(obj)
{
var tbody = obj.parentNode.parentNode.parentNode.getElementsByTagName("tbody")[0];
var old = tbody.style.display;
tbody.style.display = (old == "none" ? "" : "none");
}
</xsl:text>
</script>
<style type="text/css">
th
{
text-align: left;
cursor: pointer;
}
table tbody tr td
{
padding-left: 5px;
padding-right: 5px;
border-collapse: collapse;
}
table
{
border-top: 3px solid grey;
border-collapse: collapse;
}
</style>
</head>
<body>
<xsl:apply-templates select="Container"/>
</body>
</html>
</xsl:template>
<xsl:template match="Container|ContainerInternal">
<xsl:apply-templates select="Node"/>
</xsl:template>
<xsl:template match="Type">
<tr>
<th>
<xsl:value-of select="Feature/@type_type"/>
</th>
<td colspan="3">
<xsl:value-of select="Feature/@Value"/>
</td>
</tr>
</xsl:template>
<xsl:template match="Node">
<p>
<table BORDER="2">
<xsl:for-each select="RootBase">
<thead>
<tr bgcolor="#93B6CD" style="color: white;">
<th colspan="4" onclick="showHide(this)">
<xsl:value-of select="@name"/>
</th>
</tr>
</thead>
</xsl:for-each>
<tbody style="display: none">
<xsl:apply-templates select="Type"/>
<xsl:apply-templates select="Data"/>
<xsl:apply-templates select="Connection"/>
<xsl:apply-templates select="FeatureDefinition"/>
<xsl:if test="Container">
<tr>
<th>CONTAINER</th>
<td style="padding: 0px 0px 0px 0px;margin: 0px 0 0 0;">
<table BORDER="1" width="100%">
<xsl:apply-templates select="Container"/>
</table>
</td>
</tr>
</xsl:if>
<xsl:if test="ContainerInternal">
<p style="padding: 0px 0px 0px 0px;margin: 0px 0 0 0;">
<tr>
<th>CONTAINER_INTERNAL</th>
<td>
<table BORDER="1" width="100%">
<xsl:apply-templates select="ContainerInternal"/>
</table>
</td>
</tr>
</p>
</xsl:if>
</tbody>
</table>
</p>
</xsl:template>
<xsl:template match="FeatureDefinition">
<xsl:for-each select="Feature">
<tr bgcolor="#CEE3F6">
<th colspan="4">
<xsl:value-of select="@feature_definition_type"/>
</th>
</tr>
<xsl:apply-templates select="Type"/>
<xsl:apply-templates select="Definition"/>
<xsl:apply-templates select="Data"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="attribute_text">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="contains($text, 'xts3dx')">
<td>
<xsl:value-of select="substring-before($text, 'xts3dx')"/>
</td>
<xsl:call-template name="attribute_text">
<xsl:with-param name="text" select="substring-after($text, 'xts3dx')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<td>
<xsl:value-of select="$text"/>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="Data">
<xsl:for-each select="Feature">
<xsl:choose>
<xsl:when test="@data_type='value'">
<tr>
<th>
<xsl:value-of select="@value_type"/>
</th>
<xsl:choose>
<xsl:when test="Data/Feature/@data_type='double'">
<td colspan="3">
<xsl:value-of select="Data/Feature/@data"/>
</td>
</xsl:when>
<xsl:otherwise>
<td colspan="3">
<xsl:value-of select="Data/Feature/@data"/>
</td>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:when>
<xsl:when test="@data_type='double'">
<tr>
<xsl:if test="@double_type != 'None'">
<th>
<xsl:value-of select="@double_type"/>
</th>
</xsl:if>
<td colspan="3">
<xsl:value-of select="@data"/>
</td>
</tr>
</xsl:when>
<xsl:when test="@data_type='integer'">
<tr>
<xsl:if test="@integer_type != 'None'">
<th>
<xsl:value-of select = "@integer_type"/>
</th>
</xsl:if>
<xsl:if test="@integer_type != 'Boolean'">
<td colspan="3">
<xsl:value-of select="@data"/>
</td>
</xsl:if>
<xsl:if test="@integer_type = 'Boolean'">
<xsl:if test="@data = '0'">
<td colspan="3">FALSE</td>
</xsl:if>
<xsl:if test="@data = '1'">
<td colspan="3">TRUE</td>
</xsl:if>
</xsl:if>
</tr>
</xsl:when>
<xsl:when test="@data_type='string'">
<xsl:choose>
<xsl:when test="@string_type='None'">
<tr>
<td colspan="3">
<xsl:value-of select="@data"/>
</td>
</tr>
</xsl:when>
<xsl:when test="@string_type='Attribute'">
<tr>
<xsl:call-template name="attribute_text">
<xsl:with-param name="text" select="@data"/>
</xsl:call-template>
</tr>
</xsl:when>
<xsl:otherwise>
<tr>
<th>
<xsl:value-of select="@string_type"/>
</th>
</tr>
<tr>
<td colspan="3">
<xsl:value-of select="@data"/>
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template match="Definition">
<xsl:for-each select="Feature">
<xsl:choose>
<xsl:when test="@data_type='definition'">
<tr>
<th colspan="4" bgcolor="#E6E6E6" >
<xsl:value-of select="@definition_type"/>
</th>
</tr>
<xsl:apply-templates select="Type"/>
<xsl:apply-templates select="Connection"/>
<xsl:apply-templates select="Data"/>
<xsl:apply-templates select="Definition"/>
</xsl:when>
<xsl:when test="@data_type='definition_pattern'">
<xsl:choose>
<xsl:when test="@definition_pattern_type='InstanceStatus'">
<tr>
<th>Instance status</th>
<td colspan="3">
<xsl:value-of select=".//@data"/>
</td>
</tr>
</xsl:when>
<xsl:otherwise>
<tr style="padding: 0px 0px 0px 0px; border-collapse: collapse; border-spacing: 0px 0px 0px 0px;">
<td colspan="4" style="padding: 0px 0px 0px 0px; border-collapse: collapse;">
<table BORDER="1" width="100%" >
<thead>
<tr>
<th colspan="4" onclick="showHide(this)" bgcolor="#EFF5FB">
<xsl:value-of select="@definition_pattern_type"/>
</th>
</tr>
</thead>
<tbody style="display:none">
<xsl:apply-templates select="Type"/>
<xsl:apply-templates select="Connection"/>
<xsl:apply-templates select="Data"/>
<xsl:apply-templates select="Definition"/>
</tbody>
</table>
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@data_type='definition_hole'">
<tr>
<td style="padding: 0px 0px 0px 0px;border-spacing: 0px;" colspan="4">
<table BORDER="1" width="100%">
<th colspan="4" onclick="showHide(this)" bgcolor="#EFF5FB">
<xsl:value-of select="@definition_hole_type"/>
</th>
<tbody style="display:none">
<xsl:apply-templates select="Type"/>
<xsl:apply-templates select="Connection"/>
<xsl:apply-templates select="Data"/>
<xsl:apply-templates select="Definition"/>
</tbody>
</table>
</td>
</tr>
</xsl:when>
<xsl:when test="@data_type='definition_thread'">
<tr>
<td style="padding: 0px 0px 0px 0px;border-spacing: 0px;" colspan="4">
<table BORDER="1" width="100%">
<th colspan="4" onclick="showHide(this)" bgcolor="#EFF5FB">
<xsl:value-of select="@definition_thread_type"/>
</th>
<tbody style="display:none">
<xsl:apply-templates select="Type"/>
<xsl:apply-templates select="Connection"/>
<xsl:apply-templates select="Data"/>
<xsl:apply-templates select="Definition"/>
</tbody>
</table>
</td>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template match="Connection">
<tr bgcolor="#F5F6CE">
<th>Link</th>
<td colspan="2">
<xsl:value-of select="@Type"/>
</td>
</tr>
<xsl:apply-templates select="RootBase"/>
<tr style="padding: 0px 0px 0px 0px; border-collapse: collapse; border-spacing: 0px 0px 0px 0px;">
<td colspan="2" style="padding: 0px 0px 0px 0px; border-collapse: collapse;">
<xsl:apply-templates select="DrawingBlock"/>
</td>
</tr>
<tr style="padding: 0px 0px 0px 0px; border-collapse: collapse; border-spacing: 0px 0px 0px 0px;">
<td colspan="2" style="padding: 0px 0px 0px 0px; border-collapse: collapse;">
<xsl:apply-templates select="ReferenceOnTopology|ReferenceOnTessellation"/>
</td>
</tr>
</xsl:template>
<xsl:template match="DrawingBlock">
<table BORDER="1" width="100%">
<thead>
<tr>
<th colspan="2" onclick="showHide(this)" bgcolor="#EFF5FB" >DrawingBlock</th>
</tr>
</thead>
<tbody style="display:none">
<tr>
<xsl:apply-templates select="RootBase"/>
</tr>
<tr>
<td>Entities</td>
<td>
<xsl:value-of select="@nb_entities"/>
</td>
</tr>
<tr>
<td>Markups</td>
<td>
<xsl:value-of select="@nb_markups"/>
</td>
</tr>
<tr>
<td>Drawing blocks</td>
<td>
<xsl:value-of select="@nb_drawing_blocks"/>
</td>
</tr>
<xsl:if test="@nb_drawing_blocks != 0">
<tr style="padding: 0px 0px 0px 0px; border-collapse: collapse; border-spacing: 0px 0px 0px 0px;">
<td>Children</td>
<td colspan="2" style="padding: 0px 0px 0px 0px; border-collapse: collapse;">
<xsl:apply-templates select="DrawingBlock"/>
</td>
</tr>
</xsl:if>
</tbody>
</table>
</xsl:template>
<xsl:template match="ReferenceOnTopology|ReferenceOnTessellation">
<table BORDER="1" width="100%">
<thead>
<tr>
<th colspan="2" onclick="showHide(this)" bgcolor="#EFF5FB" >
<xsl:value-of select="@topo_type"/>
</th>
</tr>
</thead>
<tbody style="display:none">
<xsl:if test="@topo_type = 'Face'">
<td>Indexes</td>
<td>
<xsl:value-of select="@indexes"/>
</td>
</xsl:if>
<xsl:if test="@topo_type = 'Edge' or @topo_type = 'CoEdge'">
<xsl:for-each select="Edge">
<tr>
<td>Indexes</td>
<td>
<xsl:value-of select="@indexes"/>
</td>
</tr>
</xsl:for-each>
</xsl:if>
<xsl:if test="@topo_type = 'UniqueVertex' or @topo_type = 'MultipleVertex'">
<xsl:for-each select="Vertex">
<tr>
<td>Indexes</td>
<td>
<xsl:value-of select="@indexes"/>
</td>
</tr>
</xsl:for-each>
</xsl:if>
</tbody>
</table>
</xsl:template>
<xsl:template match="RootBase">
<xsl:choose>
<xsl:when test="not(@name) and @persistent_id = 0">
<!-- Do nothing -->
</xsl:when>
<xsl:when test="@name">
<td>
<xsl:value-of select="@name"/>
</td>
<td>
Persistent id:
<xsl:value-of select="@persistent_id"/>
</td>
</xsl:when>
<xsl:otherwise>
<td>
Empty name
</td>
<td>
Persistent id:
<xsl:value-of select="@persistent_id"/>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>