Re: [Xsltforms-support] Accessing the results of a multi-select
Brought to you by:
alain-couthures
From: Richard L. <ric...@gm...> - 2023-09-28 13:15:46
|
Steven, Got that: thanks. Works a treat: Richard On 28/09/2023 13:36, Steven Pemberton wrote: > On Thursday 28 September 2023 14:24:14 (+02:00), Richard Light wrote: > > On 28/09/2023 12:50, Steven Pemberton wrote: >> Using <xf:copy ref="."> instead of <xf:value ref="@id">? > > Ah, clever! (I have a lot to learn ...) > > Thank you: I can now get the text content of all the selected XML > records dumped out as a long unformatted string, using <xf:output > ref="Object/ItemList">. > > I see I can use the value attribute on <xf:output> to evaluate a > single XPath expression, but is there a way of iterating over the > nodeset of selected Object elements and just outputting selected > elements, ideally with some formatting? > > That's what <repeat ref="..."> is for. > > I have written an XForms hands-on tutorial, available at > https://cwi.nl/~steven/xforms/xforms-hands-on/ which introduces many > of these techniques, and I will be giving a follow-on advanced XForms > hands-on at the Declarative Amsterdam conference on November 1st > (online and live). > > https://declarative.amsterdam/ > > Steven > > Thanks, > > Richard > >> >> Steven >> >> On Thursday 28 September 2023 12:40:17 (+02:00), Richard Light wrote: >> >> Hi, >> >> When I make a selection from a number of options: >> >>> <xf:select bind="object-list" appearance="full"> >>> <xf:label>Objects to move:</xf:label> >>> <xf:itemset model="objects-chosen" >>> nodeset="instance('objects')/record"> >>> <xf:label ref="Object/ObjectIdentity/Number"/> >>> <xf:value ref="@id"/> >>> </xf:itemset> >>> </xf:select> >> The <object-list> in my model is dynamically populated with a >> space-separated list of id's. >> >> What I would like to be able to do is to display (elsewhere >> on the XForm) selected information for each of the objects >> which is currently selected. I can (and currently do) >> display /all /the objects, e.g.: >> >>> <h4>Object details:</h4> >>> <div> >>> <p><b><xf:output >>> ref="instance('objects')/record[1]/Object/ObjectIdentity/Number"/></b> >>> <br/><b>Identification: </b> <xf:output >>> ref="instance('objects')/record[1]/Object/Identification/ObjectName/Keyword"/>; >>> >>> <xf:output >>> ref="instance('objects')/record[1]/Object/Identification/BriefDescription"/></p> >>> </div> >> Is there a way of iterating over the selected objects and >> outputting only their details? >> >> Thanks, >> >> Richard >> >> -- >> ------------------------------------------------------------------------ >> *Richard Light* >> ric...@gm... >> /@richardofsussex/ >> > -- > ------------------------------------------------------------------------ > *Richard Light* > ric...@gm... > /@richardofsussex/ > -- ------------------------------------------------------------------------ *Richard Light* ric...@gm... /@richardofsussex/ |