Skip to content

Instantly share code, notes, and snippets.

@avernet
Created July 1, 2015 00:25
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/2e66cd254e804fc36c0f to your computer and use it in GitHub Desktop.
Save avernet/2e66cd254e804fc36c0f to your computer and use it in GitHub Desktop.
<xh:html xmlns:xf="http://www.w3.org/2002/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:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/1999/xhtml https://raw.github.com/orbeon/orbeon-forms/master/src/main/resources/org/orbeon/oxf/xml/schemas/xhtml1-transitional-orbeon.xsd">
<xh:head>
<xh:title>Orbeon CodeMirror Test</xh:title>
<xh:style type="text/css">
.CodeMirror { width: 100% !important; height: 100% !important; }
</xh:style>
<xf:model id="code-mirror">
<xf:instance id="xml" xxf:exclude-result-prefixes="#all">
<xml/>
</xf:instance>
<xf:instance id="templates" xxf:exclude-result-prefixes="#all">
<templates>
<t id="2.16.840.1.113883.3.1937.99.62.3.10.4" effectiveDate="2009-10-01T00:00:00" name="Template 1"/>
<t id="2.16.840.1.113883.3.1937.99.62.3.10.1" effectiveDate="2011-01-28T00:00:00" name="Template 2"/>
</templates>
</xf:instance>
<xf:submission id="get-template-1" serialization="none" method="get" resource="http://decor.nictiz.nl/decor/services/RetrieveTemplate?prefix=demo1-&amp;language=nl-NL&amp;id={encode-for-uri(instance('templates')/t[1]/@id)}&amp;effectiveDate={encode-for-uri(instance('templates')/t[1]/@effectiveDate)}&amp;format=xml" replace="instance" instance="xml">
<xf:message ev:event="xforms-submit-error" level="modal">
A submission error occurred: <xf:output value="event('error-type')"/>; Status: <xf:output value="event('response-status-code')"/>; URI: <xf:output value="event('resource-uri')"/>; Headers: <xf:output value="event('response-headers')"/>; Body: <xf:output value="event('response-body')"/>
</xf:message>
</xf:submission>
<xf:submission id="get-template-2" serialization="none" method="get" resource="http://decor.nictiz.nl/decor/services/RetrieveTemplate?prefix=demo1-&amp;language=nl-NL&amp;id={encode-for-uri(instance('templates')/t[2]/@id)}&amp;effectiveDate={encode-for-uri(instance('templates')/t[2]/@effectiveDate)}&amp;format=xml" replace="instance" instance="xml">
<xf:message ev:event="xforms-submit-error" level="modal">
A submission error occurred: <xf:output value="event('error-type')"/>; Status: <xf:output value="event('response-status-code')"/>; URI: <xf:output value="event('resource-uri')"/>; Headers: <xf:output value="event('response-headers')"/>; Body: <xf:output value="event('response-body')"/>
</xf:message>
</xf:submission>
<!-- resources for internationalization -->
<xf:instance id="resources-instance">
<artXformResources packageRoot="art">
<resources xml:lang="en-US" displayName="English (en-US)"/>
</artXformResources>
</xf:instance>
<!-- language -->
<xf:instance id="language">
<language>en-US</language>
</xf:instance>
<!-- Startup actions -->
<xf:action ev:event="xforms-model-construct-done">
<xf:send submission="get-template-1"/>
</xf:action>
<xxf:variable name="resources" select="instance('resources-instance')//resources[1]"/>
</xf:model>
</xh:head>
<xh:body>
<xh:table width="100%" class="detail zebra-table">
<xh:tr>
<xh:td>
<xh:div style="background-color: GhostWhite;">
<xh:div class="detail">
<xf:trigger>
<xf:label>Template 1</xf:label>
<xf:send ev:event="DOMActivate" submission="get-template-1"/>
</xf:trigger>
<xf:trigger>
<xf:label>Template 2</xf:label>
<xf:send ev:event="DOMActivate" submission="get-template-2"/>
</xf:trigger>
</xh:div>
<xh:div style="font-weight: bold;">
<xf:output ref="instance('templates')/*[@id=instance('xml')//template[1]/@id]/@name"/>
</xh:div>
<xf:repeat nodeset="instance('xml')//example">
<xh:div style="border: 1px solid black; margin-bottom: 5px;" class="not-selectable">
<fr:code-mirror ref="xxf:serialize(.,'html')"/>
<!--<xf:output mediatype="text/html" value="xxf:serialize(xxforms:call-xpl('oxf:/ops/utils/formatting/format-multiple.xpl', 'data', ., 'data'), 'html')"/>-->
</xh:div>
</xf:repeat>
</xh:div>
</xh:td>
</xh:tr>
</xh:table>
</xh:body>
</xh:html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment