Orbeon formatting.xpl to show xmlns declarations?

84 views Asked by At

Code

<xforms:output mediatype="text/html" value="xxforms:serialize(xxforms:call-xpl('oxf:/ops/utils/formatting/format.xpl', 'data', instance('message-instance'), 'data')/*, 'xml')"/>

Input

<REPC_IN000023NL xmlns="urn:hl7-org:v3">
    ....
    <hl7:patientID xmlns:hl7="urn:hl7-org:v3">
        <hl7:value root="2.16.840.1.113883.2.4.6.3" extension="999999035"/>
    </hl7:patientID>
    ....
</REPC_IN000023NL>

Expected a rendering that includes the namespace declaration, but instead the rendering omits exactly that.

Bug or feature?

1

There are 1 answers

5
avernet On

Indeed, the namespace declaration for the hl7 prefix, which isn't on the root element, is not produced:

XML output

I'd recommend you don't use that format.xpl; it isn't maintained, has performance issues with large documents, and, as you noticed, doesn't handle some corner cases well (i.e. it's buggy!).

Instead, you can use the fr:code-mirror component, which delegates formatting to CodeMirror. It won't do the indenting for you, but Saxon can do it for you. This example will give you the following output:

Using CodeMirror