diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java index 5e7b63d20..6476bc568 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java @@ -2075,8 +2075,13 @@ public class StructureDefinitionRenderer extends ResourceRenderer { if (u.contains("|") || hasMultipleVersions(context.getWorker().fetchResourcesByUrl(StructureDefinition.class, u))) { v = "("+sd.getVersion()+")"; } - String disp = sd.present()+v; - String ref = context.getPkp().getLinkForProfile(null, sd.getUrl()); + String disp = sd.present()+v; + String ref; + if (u.contains("|")) { + ref = sd.getWebPath(); + } else { + ref = context.getPkp().getLinkForProfile(null, sd.getUrl()); + } if (ref != null && ref.contains("|")) ref = ref.substring(0, ref.indexOf("|")); c.addPiece(checkForNoChange(t, gen.new Piece(ref, disp, null))); @@ -2762,10 +2767,20 @@ public class StructureDefinitionRenderer extends ResourceRenderer { boolean used = false; Row choicerow = gen.new Row(); choicerow.setId(element.getPath()); - String t = tr.getWorkingCode(); - if (isReference(t)) { + String ts = tr.getWorkingCode(); + String tu = tr.getWorkingCode(); + if (Utilities.isAbsoluteUrl(ts)) { + StructureDefinition sd = context.getContext().fetchResource(StructureDefinition.class, ts); + if (sd != null) { + ts = sd.getType(); + } + } + if (Utilities.isAbsoluteUrl(ts)) { + ts = utail(ts); + } + if (isReference(tu)) { used = true; - choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), null, null)); + choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(ts)), null, null)); choicerow.getCells().add(gen.new Cell()); choicerow.getCells().add(gen.new Cell(null, null, "", null, null)); choicerow.setIcon("icon_reference.png", context.formatPhrase(RenderingContext.TEXT_ICON_REFERENCE)); @@ -2804,19 +2819,19 @@ public class StructureDefinitionRenderer extends ResourceRenderer { } } else { - StructureDefinition sd = context.getWorker().fetchTypeDefinition(t); + StructureDefinition sd = context.getWorker().fetchTypeDefinition(tu); if (sd == null) { if (DEBUG) { - System.out.println("Unable to find "+t); + System.out.println("Unable to find "+tu); } - sd = context.getWorker().fetchTypeDefinition(t); + sd = context.getWorker().fetchTypeDefinition(tu); } else if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) { used = true; - choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), sd.getDescription(), null)); + choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(ts)), sd.getDescription(), null)); choicerow.getCells().add(gen.new Cell()); choicerow.getCells().add(gen.new Cell(null, null, "", null, null)); choicerow.setIcon("icon_primitive.png", context.formatPhrase(RenderingContext.TEXT_ICON_PRIMITIVE)); - Cell c = gen.new Cell(null, corePath+"datatypes.html#"+t, sd.getTypeName(), null, null); + Cell c = gen.new Cell(null, corePath+"datatypes.html#"+tu, sd.getTypeName(), null, null); choicerow.getCells().add(c); if (!mustSupportMode && isMustSupport(tr) && element.getMustSupport()) { c.addPiece(gen.new Piece(null, " ", null)); @@ -2824,11 +2839,11 @@ public class StructureDefinitionRenderer extends ResourceRenderer { } } else { used = true; - choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), sd.getDescription(), null)); + choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(ts)), sd.getDescription(), null)); choicerow.getCells().add(gen.new Cell()); choicerow.getCells().add(gen.new Cell(null, null, "", null, null)); choicerow.setIcon("icon_datatype.gif", context.formatPhrase(RenderingContext.TEXT_ICON_DATATYPE)); - Cell c = gen.new Cell(null, context.getPkp().getLinkFor(corePath, t), sd.getTypeName(), null, null); + Cell c = gen.new Cell(null, context.getPkp().getLinkFor(corePath, tu), sd.getTypeName(), null, null); choicerow.getCells().add(c); if (!mustSupportMode && isMustSupport(tr) && element.getMustSupport()) { c.addPiece(gen.new Piece(null, " ", null));