I am working on a BPMN transform and pull a DMN (decision table) in from an external file. But the namespace declaration in the root element looks a little strange to me, and I cannot figure out how to make my XSL match the required elements in my DMN file.
Here is the file I am referencing:
<definitions xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd" id="definitions_0fyde0d"
name="definitions" namespace="http://camunda.org/schema/1.0/dmn">
<decision id="decision" name="DRM01">
<decisionTable id="decisionTable">
<input id="input1" label="UserText">
<inputExpression id="inputExpression1" typeRef="string">
<text/>
</inputExpression>
</input>
<output id="output1" label="Subsystem" name="" typeRef="string"/>
<rule id="row-22012340-2">
<inputEntry id="UnaryTests_1hacpom">
<text>
<![CDATA["signal"]]>
</text>
</inputEntry>
<outputEntry id="LiteralExpression_0wvuvyc">
<text>
<![CDATA["input"]]>
</text>
</outputEntry>
</rule>
<rule id="row-22012340-3">
<inputEntry id="UnaryTests_0cmpu76">
<text>
<![CDATA["screen"]]>
</text>
</inputEntry>
<outputEntry id="LiteralExpression_0hkc81e">
<text>
<![CDATA["output"]]>
</text>
</outputEntry>
</rule>
<rule id="row-22012340-4">
<inputEntry id="UnaryTests_02k6et6">
<text/>
</inputEntry>
<outputEntry id="LiteralExpression_1wwd9ka">
<text>
<![CDATA["not sure"]]>
</text>
</outputEntry>
</rule>
</decisionTable>
</decision>
</definitions>
I added the namespace declaration for dmn into my XSL:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dmn="http://camunda.org/schema/1.0/dmn"
exclude-result-prefixes="xs bpmn bpmndi di dc xsi dmn"
version="2.0">
I have tried all kinds of options to match specific elements in the DMN file, but I am either getting all the CDATA or nothing at all.
Here is the line that calls the template for DMN contents:
<xsl:apply-templates select="$docfile/*" mode="dmn"/>
I can see that the element is matched when I create a template that pushes out the local-name() of the matched element. That would mean the element does not have a namespace. I use this template to process only the elements in my DMN file:
<xsl:template match="*" mode="dmn">
<xsl:apply-templates select="descendant::dmn:rule"/>
</xsl:template>
This gives no matches at all, even though I do have a template for dmn:rule. When I remove the namespace in both the apply call and the template match clause, I get the same result.
I am suspecting something about the namespace is not correct, but I cannot figure it out.