diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java index c86f2fa98..33bd3bf81 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java @@ -4145,10 +4145,12 @@ public class FHIRPathEngine { List childDefinitions = ProfileUtilities.getChildMap(sd, element); for (ElementDefinition t : childDefinitions) { if (t.getPath().endsWith(".extension") && t.hasSliceName()) { - sd = worker.fetchResource(StructureDefinition.class, t.getType().get(0).getProfile().get(0).getValue()); - while (sd!=null && !sd.getBaseDefinition().equals("http://hl7.org/fhir/StructureDefinition/Extension")) - sd = worker.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); - if (sd.getUrl().equals(targetUrl)) { + StructureDefinition exsd = worker.fetchResource(StructureDefinition.class, t.getType().get(0).getProfile().get(0).getValue()); + while (exsd!=null && !exsd.getBaseDefinition().equals("http://hl7.org/fhir/StructureDefinition/Extension")) + exsd = worker.fetchResource(StructureDefinition.class, exsd.getBaseDefinition()); + if (exsd.getUrl().equals(targetUrl)) { + if (ProfileUtilities.getChildMap(sd, t).isEmpty()) + sd = exsd; focus = t; break; } diff --git a/org.hl7.fhir.validation/src/test/resources/validation-examples/extension-slice-profile.xml b/org.hl7.fhir.validation/src/test/resources/validation-examples/extension-slice-profile.xml new file mode 100644 index 000000000..613ee17b4 --- /dev/null +++ b/org.hl7.fhir.validation/src/test/resources/validation-examples/extension-slice-profile.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.hl7.fhir.validation/src/test/resources/validation-examples/extension-slice.xml b/org.hl7.fhir.validation/src/test/resources/validation-examples/extension-slice.xml new file mode 100644 index 000000000..4fa5a6581 --- /dev/null +++ b/org.hl7.fhir.validation/src/test/resources/validation-examples/extension-slice.xml @@ -0,0 +1,13 @@ + + + + +
+
+
+ + + + + +
diff --git a/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json b/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json index 9a560d816..b869d73ae 100644 --- a/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json +++ b/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json @@ -460,6 +460,13 @@ "version" : "3.0", "questionnaire" : "questionnaire-enableWhen-test3.xml", "errorCount": 0 + }, + "extension-slice.xml" : { + "errorCount": 0, + "profile" : { + "source" : "extension-slice-profile.xml", + "errorCount": 0 + } } } }