Skip to content

Instantly share code, notes, and snippets.

@avernet
Created April 17, 2010 01:07
Show Gist options
  • Save avernet/369146 to your computer and use it in GitHub Desktop.
Save avernet/369146 to your computer and use it in GitHub Desktop.
<xhtml:html xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:dlcn="http://www.delcyon.com/xbl"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
<xhtml:head>
<xhtml:meta http-equiv="content-type"
content="text/xhtml;charset=utf-8" />
<xhtml:title>RECURSIVE XBL TEST CASE</xhtml:title>
<xforms:model id="model">
<xforms:instance id="data">
<data>
<tree>
<node nodeID="1">
<node nodeID="1.1"/>
<node nodeID="1.2" attr1="value1" attr2="value2" attr3="value3">
<node nodeID="1.2.1"/>
<node nodeID="1.2.2" attr1="value1" attr2="value2" attr3="value3">
<node nodeID="1.2.2.1"/>
<node nodeID="1.2.2.2" attr1="value1" attr2="value2" attr3="value3"/>
</node>
</node>
</node>
<node nodeID="2" attr1="value1" attr2="value2" attr3="value3">
<node nodeID="2.1"/>
<node nodeID="2.2" attr1="value1" attr2="value2" attr3="value3">
<node nodeID="2.2.1"/>
<node nodeID="2.2.2" attr1="value1" attr2="value2" attr3="value3">
<node nodeID="2.2.2.1"/>
<node nodeID="2.2.2.2" attr1="value1" attr2="value2" attr3="value3"/>
</node>
</node>
</node>
</tree>
</data>
</xforms:instance>
</xforms:model>
<xbl:xbl xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:dlcn="http://www.delcyon.com/xbl">
<xbl:binding element="dlcn|tree-view">
<xbl:resources>
<xbl:style>
div.box
{
border-color: black;
border-width: 1px;
border-style: solid;
padding: 5px;
}
</xbl:style>
</xbl:resources>
<xbl:template>
<xhtml:div class="box">
<xforms:group xbl:attr="ref" xxbl:scope="outer">
<!-- Start copying the variables over that we need -->
<xxforms:variable name="data" xxbl:scope="inner">
<xxforms:sequence select="." xxbl:scope="outer" />
</xxforms:variable>
<!-- end external variable copying -->
<!-- START MAIN GROUP-->
<xforms:group xxbl:scope="inner">
<xhtml:strong><xforms:output value="$data/local-name()" /></xhtml:strong>
<br />
<xhtml:ul>
<!-- This will display all of the attributes in this element -->
<xforms:repeat nodeset="$data/@*">
<xhtml:li>
<xhtml:strong><xforms:output value="local-name()" />: </xhtml:strong>
<xforms:output value="." />
</xhtml:li>
</xforms:repeat>
<!-- Repeat over each child node of the root node -->
<xforms:repeat nodeset="$data/*">
<xhtml:li>
<!-- if this element has children recurse into it -->
<dlcn:tree-view ref="." />
</xhtml:li>
</xforms:repeat>
</xhtml:ul>
</xforms:group>
<!-- END MAIN GROUP -->
</xforms:group>
</xhtml:div>
</xbl:template>
</xbl:binding>
</xbl:xbl>
</xhtml:head>
<xhtml:body>
<dlcn:tree-view ref="instance('data')"/>
</xhtml:body>
</xhtml:html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment