Re: [Xsltforms-support] Duplicate Id using multiple text area's with
Brought to you by:
alain-couthures
From: Winona S. <wsa...@gm...> - 2016-04-26 18:20:42
|
Yes, I am generating the forms server side. Here is my test case. Main form: <?xml-stylesheet href="xsl/xsltforms.xsl" type="text/xsl"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:tei=" http://www.tei-c.org/ns/1.0" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xf=" http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events"> <head> <title>Wrap Selection</title> <xf:model> <xf:instance xmlns="http://www.tei-c.org/ns/1.0" id="i-rec"> <TEI> <note> <quote> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam dapibus quis lacus vitae lacinia. Donec sit amet mi at quam pellentesque faucibus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. </quote> </note> <desc>Pellentesque at lacus efficitur, efficitur ligula nec, tincidunt nulla. Nunc nec porta urna, id tempor ipsum. Mauris id dolor id nisl vulputate facilisis.</desc> <desc> <quote>Vivamus risus metus, cursus sed auctor eu, rhoncus ut nunc.</quote> </desc> </TEI> </xf:instance> <xf:instance xmlns="http://www.tei-c.org/ns/1.0" id="i-add-name" > <name ref="http://syriaca.org/"></name> </xf:instance> </xf:model> </head> <body> <xf:repeat ref="instance('i-rec')/tei:note" id="new-note"> <xi:include href="quote-el.xml"></xi:include> <xf:group ref="self::*[not(tei:quote/@source)]"> <h3>Note, no quote</h3> <span class="input-group mixed-content"> <span class="form-control"> <xf:input ref="instance('i-add-name')/@ref" class= "input-md"> <xf:label>URI</xf:label> </xf:input> </span> <xf:trigger appearance="minimal" class="btn btn-default input-group-addon"> <xf:label><persName></xf:label> <xf:wrap ev:event="DOMActivate" control="n" pre="<persName ref="{instance('i-add-name')/@ref}">" post="</persName>"></xf:wrap> </xf:trigger> </span> <br /> <xf:textarea id="n" ref="." incremental="true" ></xf:textarea> </xf:group> </xf:repeat> <xf:repeat ref="instance('i-rec')//tei:desc" id="new-desc"> <xi:include href="quote-el.xml"></xi:include> <xf:group ref="self::*[not(tei:quote/@source)]"> <h3>Desc, no quote</h3> <span class="input-group mixed-content"> <span class="form-control"> <xf:input ref="instance('i-add-name')/@ref" class= "input-md"> <xf:label>URI</xf:label> </xf:input> </span> <xf:trigger appearance="minimal" class="btn btn-default input-group-addon"> <xf:label><persName></xf:label> <xf:wrap ev:event="DOMActivate" control="d" pre="<persName ref="{instance('i-add-name')/@ref}">" post="</persName>"></xf:wrap> </xf:trigger> </span> <br /> <xf:textarea id="d" ref="." incremental="true" ></xf:textarea> </xf:group> </xf:repeat> </body> </html> Nested quote element is in quote-el.xml <div xmlns="http://www.w3.org/1999/xhtml" xmlns:xi=" http://www.w3.org/2001/XInclude" xmlns:ev="http://www.w3.org/2001/xml-events " xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xf=" http://www.w3.org/2002/xforms"> <xf:group ref="tei:quote"> <h3>Quote</h3> <span class="input-group mixed-content"> <span class="form-control"> <xf:input ref="instance('i-add-name')/@ref" class= "input-md"> <xf:label>URI</xf:label> </xf:input> </span> <xf:trigger appearance="minimal" class="btn btn-default input-group-addon"> <xf:label><persName></xf:label> <xf:wrap ev:event="DOMActivate" control="q" pre="<persName ref="{instance('i-add-name')/@ref}">" post="</persName>"/> </xf:trigger> </span> <br/> <xf:textarea id="q" ref="." incremental="true"/> </xf:group> </div> On Tue, Apr 26, 2016 at 1:56 PM, Alain Couthures < ala...@ag...> wrote: > Yes, a minimal test case is required. > > Ids are automatically generated by XSLTForms when missing. Are you > generating your forms at server side ? > > --Alain > > > Le 26/04/2016 à 19:49, Winona Salesky a écrit : > >> I am using the new wrap function (a great addition!) and am trying to >> simplify my forms as much as possible. This has led me to use a lot of >> xincludes for nested data structures. >> >> Example: tei:quote is a valid sub-element of tei:note and tei:desc. I >> want to use the wrap function on the tei:quote, and would like, if possible >> to only have one 'template' for the all the fields need for the tei:quote >> element, that is used by both tei:note and tei:desc. >> >> Currently I get a duplicate id error if I use both a tei:note and a >> tei:desc. Is there a way to generate ids based on parent element? Or do I >> just need to maintain two different templates with unique ids? >> >> Thanks for the help. And let me know if a code example would be useful. >> -Winona >> > > |