Le 8 mai 2013 à 23:56, Gyani vaddi a écrit :
> Hello Stéphane
>
> I have been using your editor for making customized xml forms and it works great! I do have a couple of questions about the editor.
Thanks a lot, do not hesitate to share with us your experiences / use cases
> 1. Is there a way to insert an empty xml element in the xml output file, i.e.,
> If i declare a new component and insert it in the xhtml file as follows:
>
> <xt:component name="test"> <xt:use types="str"/></xt:component>
>
> and then, I say, <xt: use types="test" label="foo"/>, Is there a way my xml file can say <test/> if the user doesn't enter any input in the field, instead of <test>enter your text here</test>. also, Is there a way I can insert pure xml tags instead of using <xt:use types>?
So if I rephrase it you would like to generate a <test> tag in the output filled with the content of a "text" input field, but with an empty content <test/> when user does not enter text.
You are right that this is not possible currently, since AXEL serialization algorithm will copy the default content from the input field and if you do not provide default content the "text" primitive editor will set its default content to "click to edit" such as in <xt:use types="text" label="test"/>
(note that since AXEL 1.3.1beta I have removed the deprecated "string" primitive editor, so instead of <xt:use types="string"...> you must use <xt:use types="text"...>, see the documentation for the "text" primitive editor at
http://ssire.github.io/xtiger-xml-spec/#text and
http://ssire.github.io/axel/editor/editor.xhtml#plugins/Text)
However you can use the following trick to get the desired effect: declare your text entry field as optional and unset by default (with the option="unset" attribute) and use CSS to hide the check box, so that would give something like :
<span class="trick"><xt:use types="text" label="Test" option="unset">enter some text</xt:use></span>
and somewhere in your page you must declare:
<style type="text/css" media="screen">
.trick > .axel-option-checkbox {
display: none;
}
</style>
For styling AXEL you can read
http://ssire.github.io/xtiger-xml-spec/#styling
If you want to do more form-oriented documents, I also draw you attention on the AXEL-FORMS library (which is a complement to AXEL) where the "input" plugin has also the desired effect without the above trick. See for instance
http://ssire.github.io/axel-forms/editor/editor.xhtml#plugins/Input
To insert pure XML tags in the output (in fact to insert ANY tag) you must use the "label" attribute on the <xt:use> element. The label attribute opens a new XML tag in the output stream. In fact the only case when the types="...." attribute opens an XML tag in the output stream is when it is used to give the choice to the user between several xt:component declared in the xt:head section. This is explained in the specfication
http://ssire.github.io/xtiger-xml-spec/#use
Since you are not the only one to ask those kind of questions I have also written a new executive summary document to help (I hope) understand the XTiger XML specification and its AXEL implementation, you may have a look at it :
http://ssire.github.io/axel/docs/xtiger-summary.html
> 2. When I try to load data from an xml file to an existing template, all the data is not loaded in the editor. especially, the data with in <xt:repeat/> elements. Is there a way to be able to load it or is it how the editor is designed?
This is not normal, it should be loaded. Did you declare either a label or a pseudoLabel (be careful with the capital "L") attribute on the xt:repeat element ? You must have one of them. It is frequent to forget the pseudoLabel attribute when not declaring an explicit label.
See the explanations here:
http://ssire.github.io/xtiger-xml-spec/#repeat
There is a medium size template that may help you figure it out (with Firefox click on the "Browse" button to see its source), this is :
http://ssire.github.io/axel/editor/editor.xhtml#samples/Page
Regards,
Stéphane S.
---