Guest User

A xsltforms with xf:select's xf:itemset updated from submision

a guest
Apr 20th, 2010
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.63 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?xml-stylesheet href="xsltforms/xsltforms.xsl" encoding="UTF-8"
  3. type="text/xsl"?>
  4. <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"
  5.  xmlns:xf="http://www.w3.org/2002/xforms"
  6.  xmlns:ev="http://www.w3.org/2001/xml-events"
  7.  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  8.  xsi:schemaLocation="
  9.     http://www.w3.org/2002/xforms
  10. http://www.w3.org/MarkUp/Forms/2007/XForms-11-Schema.xsd
  11.     http://www.w3.org/2001/xml-events
  12. http://www.w3.org/MarkUp/SCHEMA/xml-events-attribs-1.xsd
  13. ">
  14.   <head>
  15.     <title>Restore xf:itemsets on xf:reset</title>
  16.     <xf:model id="model-main" >
  17.       <xf:instance id="inst-main">
  18.         <main>
  19.           <data >1</data>
  20.         </main>
  21.       </xf:instance>
  22.       <xf:instance id="inst-items" >
  23.         <items>
  24.           <item>1</item>
  25.           <item>2</item>
  26.           <item>3</item>
  27.         </items>
  28.       </xf:instance>
  29.  
  30.       <xf:bind id="bind-data" nodeset="/main/data" />
  31.  
  32.       <xf:submission id="sub-fetch-items" resource="items.xml" method="GET"
  33.          replace="instance" instance="inst-items"
  34.      >
  35.       </xf:submission>
  36.     </xf:model>
  37.   </head>
  38.  
  39.   <body>
  40.     <p>Data: <xf:output  ref="/main/data"/> </p>
  41.     <p>xf:itemset's bound-document contents:
  42.       <xf:repeat nodeset="instance('inst-items')/item">
  43.         <xf:output  ref="."/>
  44.       </xf:repeat>
  45.     </p>
  46.     Select1(minimal): <xf:select1 ref="/main/data">
  47.       <xf:itemset nodeset="instance('inst-items')/item">
  48.         <xf:label ref="." />
  49.         <xf:value ref="." />
  50.       </xf:itemset>
  51.     </xf:select1>
  52.     Select1(full): <xf:select1 ref="/main/data" appearance="full">
  53.       <xf:itemset nodeset="instance('inst-items')/item">
  54.         <xf:label ref="." />
  55.         <xf:value ref="." />
  56.       </xf:itemset>
  57.     </xf:select1>
  58.  
  59.     Select(minimal): <xf:select ref="/main/data">
  60.       <xf:itemset nodeset="instance('inst-items')/item">
  61.         <xf:label ref="." />
  62.         <xf:value ref="." />
  63.       </xf:itemset>
  64.     </xf:select>
  65.  
  66.     <xf:trigger>
  67.       <xf:label>Load items from file</xf:label>
  68.       <xf:action ev:event="DOMActivate" >
  69.         <xf:send submission="sub-fetch-items"/>
  70.       </xf:action>
  71.     </xf:trigger>
  72.     <xf:trigger>
  73.       <xf:label>Delete bound xf:itemset nodes</xf:label>
  74.       <xf:action ev:event="DOMActivate" >
  75.         <xf:delete nodeset="instance('inst-items')/*"/>
  76.       </xf:action>
  77.     </xf:trigger>
  78.  
  79.     <xf:trigger>
  80.       <xf:label>Reset restores only xf:delete effects</xf:label>
  81.       <xf:action ev:event="DOMActivate" >
  82.         <xf:reset/>
  83.       </xf:action>
  84.     </xf:trigger>
  85.  
  86.   </body>
  87. </html>
Advertisement
Add Comment
Please, Sign In to add comment