{"id":782,"date":"2010-01-20T01:06:30","date_gmt":"2010-01-20T08:06:30","guid":{"rendered":"https:\/\/dubinko.info\/blog\/?p=782"},"modified":"2010-01-20T01:06:30","modified_gmt":"2010-01-20T08:06:30","slug":"xforms-binding","status":"publish","type":"post","link":"https:\/\/dubinko.info\/blog\/2010\/01\/xforms-binding\/","title":{"rendered":"XForms: binding to an optional element"},"content":{"rendered":"<p>I asked this on the XSLTForms list, but it&#8217;s worth casting a wider net.<\/p>\n<p>Say I have an XML instance like this:<br \/>\n&lt;root&gt;<br \/>\n&lt;format&gt;xml&lt;\/format&gt;<br \/>\n&lt;\/root&gt;<\/p>\n<p>Possible values for the format element are &#8220;xml&#8221;, &#8220;text&#8221;, &#8220;binary&#8221;, or a default setting, indicated by a complete absence of the &lt;format&gt; element. I&#8217;d like this to attach to a select1 with four choices:<\/p>\n<p>&lt;xf:select1 ref=&#8221;format&#8221;&gt;&#8230;<\/p>\n<p>* xml<br \/>\n* text<br \/>\n* binary<br \/>\n* default<\/p>\n<p>Where the first three set the value of the &lt;format&gt; element, and the fourth omits the element altogether. In XForms 1.0, the difficulty comes from binding to a nonexistent element, which causes it to become non-relevant. Are there features from 1.1, 1.2, or extensions that make this case easier? Anyone have an example?<\/p>\n<p>-m<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I asked this on the XSLTForms list, but it&#8217;s worth casting a wider net. Say I have an XML instance like this: &lt;root&gt; &lt;format&gt;xml&lt;\/format&gt; &lt;\/root&gt; Possible values for the format element are &#8220;xml&#8221;, &#8220;text&#8221;, &#8220;binary&#8221;, or a default setting, indicated by a complete absence of the &lt;format&gt; element. I&#8217;d like this to attach to a&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[33,13],"tags":[937,938,540,1157,1153],"class_list":["post-782","post","type-post","status-publish","format-standard","hentry","category-annoyance","category-xforms","tag-optional","tag-relevant","tag-schema","tag-xforms","tag-xml"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8eo8l-cC","_links":{"self":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts\/782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/comments?post=782"}],"version-history":[{"count":1,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts\/782\/revisions"}],"predecessor-version":[{"id":783,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts\/782\/revisions\/783"}],"wp:attachment":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/media?parent=782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/categories?post=782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/tags?post=782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}