Skip to content

Instantly share code, notes, and snippets.

Created April 14, 2013 16:03
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 Tingenek/5383214 to your computer and use it in GitHub Desktop.
Save Tingenek/5383214 to your computer and use it in GitHub Desktop.
Cascaded selects followed by assembly into a new instance for submission
<!-- Process for A -->
<process id="id-process-A">
<!-- Pipelines for A -->
<pipeline id="id-pipeline-A1">
<cmdline id="id-cmdline1-fo-a-and-b">
<!-- Command line for A FO -->
<cmdline id="id-cmdline2-fo-a-and-b">
<!-- Command line for A and B -->
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/resources/xsltforms/xsltforms.xsl" type="text/xsl"?>
<?xsltforms-options debug="no"?>
<html xmlns="" xmlns:ev=""
xmlns:xs="" xmlns:xf="">
<style type="text/css">
.code {
font-family: monospace;
white-space: pre;
<!-- Temp data from the selections -->
<xf:instance id="scratchpad">
<data xmlns="">
<theprocess />
<thepipeline />
<thecmds />
<!-- Target for built process -->
<xf:instance id="mytarget">
<data xmlns="">
<!-- Source Data -->
<xf:instance id="mysource" src="process.xml" />
<!-- Set the list defaults to be first values in process.xml -->
<xf:action ev:event="xforms-ready">
<xf:setvalue ref="theprocess" value="instance('mysource')/process[1]/@id" />
<xf:setvalue ref="thepipeline"
value="instance('mysource')/process[1]/pipelines/pipeline[1]/@id" />
<xf:setvalue ref="thecmds"
value="instance('mysource')/process[1]/pipelines/pipeline[1]/cmdlines/cmdline[1]/@id" />
<h3>Pick Something</h3>
<!-- I know, I'm going to hell for using a table, not css. -->
<!-- Process -->
<xf:select1 appearance="compact" incremental="false" ref="theprocess">
<xf:itemset nodeset="instance('mysource')/process">
<xf:label ref="@id" />
<xf:value ref="@id" />
<!-- Pipeline -->
<xf:select1 appearance="compact" incremental="false" ref="thepipeline">
nodeset="instance('mysource')/process[@id = instance('scratchpad')/theprocess]/pipelines/pipeline">
<xf:label ref="@id" />
<xf:value ref="@id" />
<!-- Commands -->
<xf:select1 appearance="compact" incremental="false" ref="thecmds">
nodeset="instance('mysource')/process[@id = instance('scratchpad')/theprocess]/pipelines/pipeline[@id = instance('scratchpad')/thepipeline]/cmdlines/cmdline">
<xf:label ref="@id" />
<xf:value ref="@id" />
<xf:label>Build Me!</xf:label>
<xf:action ev:event="DOMActivate">
<xf:delete nodeset="instance('mytarget')/processes/process"/>
<xf:insert context="instance('mytarget')/processes"
origin="instance('mysource')/process[@id = instance('scratchpad')/theprocess]" />
<xf:delete nodeset="instance('mytarget')/processes/process[1]/pipelines/pipeline[@id != instance('scratchpad')/thepipeline]" />
<xf:delete nodeset="instance('mytarget')/processes/process[1]/pipelines/pipeline[1]/cmdlines/cmdline[@id != instance('scratchpad')/thecmds]" />
<!-- your xf:send would go here :-) -->
<p class="code">
<xf:output value="serialize(instance('mytarget'),'yes')" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment