From: Alfredo C. <alf...@gm...> - 2021-07-26 14:31:56
|
Hi Joe, yes I did, a couple of years ago, but I discarded the use of XForms because for the textareas they used an editor (it seems to me CKeditor) and to change it was necessary to completely recompile the application (and I have no idea how to do it) . Since I needed an XML editor I developed my own CODEMIRROR configuration dedicated to TEI-XML which guides my editors to write XML easily and, on the side, also has a "note taking environment" https://orazionelson.github.io/CodeMirrorXML4TEI/ https://orazionelson.github.io/CodeMirrorXML4TEI/editor.html Thanks for the suggestions, I will try to study the links you gave me. Alfredo Il giorno lun 26 lug 2021 alle ore 15:28 Joe Wicentowski <jo...@gm...> ha scritto: > Hi Alfredo, > > It sounds like you're trying to take the input of HTML forms and generate > XML documents from the input. Have you investigated XForms, which can > natively store XML models in the browser and submit XML instances to eXist? > For XForms implementations, see XSLTForms [1] and Fore ("XFormish") [2]. To > learn more about XForms, see Steven Pemberton's tutorial [3]. > > [1] > https://github.com/AlainCouthures/declarative4all/raw/master/public/direct/xsltforms.zip > [2] https://github.com/Jinntec/Fore > [3] https://homepages.cwi.nl/~steven/xforms/xforms-hands-on/ > > Joe > > > On Sun, Jul 25, 2021 at 1:46 PM Alfredo Cosco <alf...@gm...> > wrote: > >> Hello Joe, Hi all, >> thanks for the code on github, I'm going to use it as a starting point >> but reading your message I realized that in few I'll have other problems to >> face. >> >> For example, if an element admits more than one attribute I'll have two >> identical code snapshots to merge with different attributes. >> >> I'll try to write rules from different cases, but after this thread I'm >> also thinking of rewriting all the logic of my script. >> >> What I'm trying to do is to create a TEI document starting from a >> web-form, the form may vary depending from the user configurations >> >> So: >> 1) I set the attribute "name" in the html input in this way: >> *fileDesc_titleStmt_title* or * >> fileDesc_sourceDesc_msDesc_physDesc_objectDesc *or (for attributes) >> *fileDesc_sourceDesc_msDesc_physDesc_objectDesc_@form* >> >> 2) Thanks to this forum I found a way (few weeks ago) to transform the >> *name* value in an XML snapshot: >> <fileDesc> >> <titleStmt> >> <title/> >> </titleStmt> >> </fileDesc> >> >> 3) Then I merge the snapshots and store an empty document in the database >> >> 4) Then I add the element and attribute values using the "UPDATE INSERT" >> >> In theory the approach works, but in practice seems to bring more >> troubles than solutions :\ >> >> What do you think? >> >> Alfredo >> >> >> >> >> >> >> >> >> Il giorno dom 25 lug 2021 alle ore 17:54 Joe Wicentowski < >> jo...@gm...> ha scritto: >> >>> Hi Alfredo, >>> >>> Slav asks good questions about the assumptions in your sample code. >>> Assuming that duplicates should be merged rather than preserved, and >>> testing only for element names (i.e., not examining attribute or text >>> nodes), here's a basic query that will merge your fragments together into a >>> structure approximating your target: >>> >>> https://gist.github.com/joewiz/b38279b8bd33de6949bb891370f76a04 >>> >>> Note that the order of fragments in the sequence you pass to the >>> merge-fragments function is important. This is because when a new fragment >>> is tested against the running composite document, if an element in the >>> fragment doesn't match the element in the composite document, the >>> fragment's element is deposited first before the rest of the composite >>> document. This is why var3's titleStmt element appears first in the >>> composite document, and var2's msIdentifier appears before var1's physDesc. >>> >>> Hopefully this gets you off to a good start and you're able to add any >>> necessary checks besides element name to this to meet any other unstated >>> assumptions / requirements. >>> >>> Joe >>> >>> On Sun, Jul 25, 2021 at 7:32 AM Слава Седов <wet...@gm...> wrote: >>> >>>> Hi, >>>> >>>> If your input and output set as testcase - it is 100% testcase or data >>>> may vary? Do you need removing any duplicates if any or it is not possible >>>> in your input? >>>> >>>> With best wishes, >>>> Slav >>>> >>>> вс, 25 июл. 2021 г., 14:56 Alfredo Cosco <alf...@gm...>: >>>> >>>>> Hi Jean-Paul, >>>>> I'm trying to merge the pieces on an "in memory" document then to >>>>> store the result in a new document. >>>>> But this logic can change if there is a better way. >>>>> Thanks, >>>>> Alfredo >>>>> >>>>> Il giorno sab 24 lug 2021 alle ore 19:16 Jean-Paul Rehr < >>>>> re...@gm...> ha scritto: >>>>> >>>>>> Alfredo, are you creating a TEI document in memory, or are you trying >>>>>> to insert these into an existing document stored in eXist-db? >>>>>> >>>>>> JPR >>>>>> >>>>>> On Sat, Jul 24, 2021 at 7:04 PM Alfredo Cosco < >>>>>> alf...@gm...> wrote: >>>>>> >>>>>>> Hi all, >>>>>>> I'm working on eXist 4.7 >>>>>>> The problem is: >>>>>>> >>>>>>> I have tre variables with XML code: >>>>>>> >>>>>>> let $var1 := <fileDesc> >>>>>>> <sourceDesc> >>>>>>> <msDesc> >>>>>>> <physDesc> >>>>>>> <objectDesc form=""/> >>>>>>> </physDesc> >>>>>>> </msDesc> >>>>>>> </sourceDesc> >>>>>>> </fileDesc> >>>>>>> >>>>>>> >>>>>>> let var2 := <fileDesc> >>>>>>> <sourceDesc> >>>>>>> <msDesc> >>>>>>> <msIdentifier> >>>>>>> <idno/> >>>>>>> </msIdentifier> >>>>>>> </msDesc> >>>>>>> </sourceDesc> >>>>>>> </fileDesc> >>>>>>> >>>>>>> let var3 := <fileDesc> >>>>>>> <titleStmt> >>>>>>> <title/> >>>>>>> </titleStmt> >>>>>>> </fileDesc> >>>>>>> >>>>>>> How can I merge there 3 snapshots and obtain something like: >>>>>>> >>>>>>> <fileDesc> >>>>>>> <titleStmt> >>>>>>> <title/> >>>>>>> </titleStmt> >>>>>>> <sourceDesc> >>>>>>> <msDesc> >>>>>>> <physDesc> >>>>>>> <objectDesc form=""/> >>>>>>> </physDesc> >>>>>>> <msIdentifier> >>>>>>> <idno/> >>>>>>> </msIdentifier> >>>>>>> </msDesc> >>>>>>> </sourceDesc> >>>>>>> </fileDesc> >>>>>>> >>>>>>> >>>>>>> Thanks, >>>>>>> Alfredo >>>>>>> _______________________________________________ >>>>>>> Exist-open mailing list >>>>>>> Exi...@li... >>>>>>> https://lists.sourceforge.net/lists/listinfo/exist-open >>>>>>> >>>>>> _______________________________________________ >>>>> Exist-open mailing list >>>>> Exi...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/exist-open >>>>> >>>> _______________________________________________ >>>> Exist-open mailing list >>>> Exi...@li... >>>> https://lists.sourceforge.net/lists/listinfo/exist-open >>>> >>> |