Re: [Xsltforms-support] A newbie seeking some guidance...
Brought to you by:
alain-couthures
From: Josselin M. <mor...@gm...> - 2021-02-10 20:09:55
|
Hi Ralph, I don’t know if your are trying to work with the first instance (we cannot access to the listPerson.xml file) or your #template instance, but I suspect an error with your Xpath. If your listPerson is a XML-TEI file, your xml-tree should be something like : <TEI xmlns="http://www.tei-c.org/ns/1.0"> <teiHeader/> <text> <body> <listPerson> <person> <!-- person 1 --> <persName> <surname></surname> <forename></forename> </persName> </person> </listPerson> </body> </text> </TEI> Then if you want to target the surname and forename tags, your Xpath should be something like /TEI/text/body/listPerson/person/persName/surname and /TEI/text/body/listPerson/person/persName/forename. You can use xf:group/@ref to shorten your link : <xf:group ref="/TEI/text/body/listPerson/person/persName"> <label>why does this not work?</label> <xf:input ref="forename"><label>Forename</label></xf:input> <xf:input ref="surname"><label>Surname></label></xf:input> </xf:group> If your are trying to work with your #template instance, your Xpath is also wrong and as it is not your first instance, you need to specify it in the @ref : <xf:group ref="instance('template')/TEI/text/body/listPerson/person/persName"> <label>why does this not work?</label> <xf:input ref="forename"><label>Forename</label></xf:input> <xf:input ref="surname"><label>Surname></label></xf:input> </xf:group> I think you’ll also have to correct your xpath with your trigger to insert a new person. Finally, if you plan to manage more than one person at a time, you should take a look at the xf:repeat element. (https://www.w3.org/TR/xforms11/#ui-repeat <https://www.w3.org/TR/xforms11/#ui-repeat>) If you declared a namespace (with listPerson.xml ?) it can also be the origin of your issue as some browsers don’t handle the namespace declarations very well, but first let’s try with corrected Xpath and keep us informed! Best, Josselin. > Le 10 févr. 2021 à 19:04, Ralph Corrigan <ra...@ra...> a écrit : > > Hi, > Apologies for this as I'm sure that I'm missing something extremely basic, but I'm having problems with implementing Xsltforms running via an Apache server on a Synology NAS (for now). I'm totally new to Xforms (in any implementation) but have been working with TEI xml and fetchXML for a couple of years, so I'm comfortable with that side of things. > > All of the test forms downloaded with the implementation work fine - they have no problems at all. However, apparently simple changes cause the form to either not render at all (without error message) or with key parts missing. > > In the following example, I've changed some bits of Steve Pemberton's 'todo.xml'. This form is a partial success in that the form does render, and the s01 submission demonstrates that the src xml has been found and read. However, the input fields (and I've deliberately kept this short after the full model failed) do not appear (see image). There are no errors in the trace log and the profiler recognises that the 2 input fields exist. They just aren't being displayed. > > This problem is happening on all the examples I modify - I would understand it (more) if the triggers failed as I'm new to this, but failing to even render input/label seems really odd (and suggests that I'm making a very basic error)! > > Any help gratefully received > > Ralph > > > <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> > <?xsltforms-options debug="yes"?> > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:xf="http://www.w3.org/2002/xforms" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > <head> > <title> New Person</title> > <xf:model> > <xf:instance src="listPerson.xml <http://192.168.0.10/ralphy/xslt/listPerson.xml>"/> > <xf:instance id="template"> > <items xmlns=""> > <TEI><text><body><listPerson> > <person> > <persName><forename>Forename</forename><surname>Surname</surname></persName> > <occupation><rolename></rolename></occupation> > </person> > </listPerson></body></text></TEI> > </items> > </xf:instance> > <xf:submission id="save" method="put" action="listperson.xml" replace="none"/> > <xf:submission id="s01" method="post" show="new" replace="all" action="xsltforms/txs.php?exec=beautify.txs"> > <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> > </xf:submission> > </xf:model> > > </head> > <body> > <xf:group> > <label>why does this not work?</label> > > <xf:input ref="forename"><label>Forename</label></xf:input> > <xf:input ref="surname"><label>Surname></label></xf:input> > > </xf:group> > <xf:trigger> > <xf:label>New</xf:label> > <xf:action ev:event="DOMActivate"> > <xf:insert context="/items" origin="instance('template')/person" nodeset="persName" position="after" at="count(persName)"/> > </xf:action> > </xf:trigger> > <xf:submit submission="s01"> > <xf:label>View</xf:label> > </xf:submit> > </body> > </html> > <c709c5ba.png> > > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support |