Skip to content

Instantly share code, notes, and snippets.

@avernet
Created June 19, 2015 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avernet/137ccd0ca06a556e6649 to your computer and use it in GitHub Desktop.
Save avernet/137ccd0ca06a556e6649 to your computer and use it in GitHub Desktop.
Showing formatted XML / HTML
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xh:head>
<xf:model>
<xf:instance><source/></xf:instance>
<xf:instance id="serialization">
<xsl:output method="xml"
omit-xml-declaration="yes"
indent="yes"
saxon:indent-spaces="4"/>
</xf:instance>
<xf:instance xxf:exclude-result-prefixes="#all" id="hl7" xxf:strip="*">
<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>
</xf:instance>
<xf:bind ref="." readonly="true()"/>
<xf:action event="xforms-model-construct-done">
<!-- Imperfect way to normalize text nodes in the instance, a-la-XSLT, for the indent to work -->
<xf:delete ref="instance('hl7')//text()[normalize-space() = '']"/>
<xf:setvalue ref="." value="saxon:serialize(instance('hl7'), instance('serialization'))"/>
</xf:action>
</xf:model>
</xh:head>
<xh:body>
<fr:code-mirror ref="instance()"/>
</xh:body>
</xh:html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment