Question about Axel editor

25 views
Skip to first unread message

Gyani vaddi

unread,
May 8, 2013, 5:56:54 PM5/8/13
to axel...@googlegroups.com
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.

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>?

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?

Thanks
Jyani

Stephane

unread,
May 9, 2013, 2:07:00 PM5/9/13
to axel-dev, Gyani vaddi
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.
---

Gyani vaddi

unread,
May 11, 2013, 1:42:53 PM5/11/13
to Stephane, axel-dev
Thank you!

I am using AXEL to put together an interface for creating an XML-database of samples in our research lab.

Your suggestions definitely helped fix the issues. You were right, I did not have pseudoLabels and that was the causing problem loading templates. I fixed it. My other question is, Will the template scripts still be valid if I now migrate to AXEL-FORMS library or do I have to make changes to the syntax in AXEL editor? Also, I am using AXEL 1.1.2 which is not the latest version I suppose?

Thanks
Jyani



Regards

Gyani

Stephane

unread,
May 13, 2013, 6:28:50 AM5/13/13
to axel-dev, Gyani vaddi
Hello,

Le 11 mai 2013 à 19:42, Gyani vaddi a écrit :
> I am using AXEL to put together an interface for creating an XML-database of samples in our research lab.
>
> Your suggestions definitely helped fix the issues. You were right, I did not have pseudoLabels and that was the causing problem loading templates. I fixed it. My other question is, Will the template scripts still be valid if I now migrate to AXEL-FORMS library or do I have to make changes to the syntax in AXEL editor? Also, I am using AXEL 1.1.2 which is not the latest version I suppose?

Yes 1.1.2 is not the latest version. From 1.1.2 I have jumped directly to 1.3.0 meaning there will be no 1.2 stable version [0].

Currently I am cleaning up the code and stabilizing a developer's friendly architecture and API in the 1.3.x series (to prepare 1.4.0 stable release). For instance I have reached a first step that was to implement and document a new plugin API and a new filter API (for Javascript developers) and document them [3] and [4]. I am now simplifying the API to invoke AXEL (using a $axel wrapped set object a-la jQuery instead of classes such as xtiger.util.Form [5], however I will keep xtiger.util.Form along the 1.x versions).

The current "discipline" is that each time I reach an interesting point into the development of the 1.3.x series I create a tag including a fresh built of the axel.js library [1].

However if you have installed "ant" and the "Yahoo UI compressor" as explained in the README [2] you can check out the latest commit on the master branch (e.g. "git clone https://github.com/ssire/axel.git") and then use "cd scripts; ant build.lib" to build the "axel.js" library file.

I try to keep backward compatibility in all versions 1.x of the AXEL library, you should be able to interchange the "axel.js" library (and maybe update your "axel/bundles" folder) in your deployed applications. However it is advised to test it first !

The only things I have broken since 1.1.2 are the following ones:
- replace "string" primitive editor with "text" primitive editor
- if you use flows (@flow on xt:use) it is no longer available

I do not plan to change anything else in the 1.x versions, only internal changes to open up new possibilities (and a new external Javascript API around the $axel wrapped set).

AXEL-FORMS is currently another project / library that depends on AXEL and on jQuery (note that you can use AXEL itself w/o jQuery except for some extra features available only with jQuery).

AXEL-FORMS [6] leverages AXEL to create more form-oriented editors and to support dynamical constraint checking while editing (bindings) in a declarative way (using microformats). It also defines some commands (using microformats) to transform templates and load / save XML document w/o writing Javascript (w/o using the AXEL xtiger.util.Form API [7]).

To use AXEL-FORMS you need to add the "axel-forms.js" library to your project. Note that AXEL-FORMS is less stable than AXEL in the sense that it is evolving quickly to add new plugins / bindings / commands, and I authorize myself some experimentations as it is quite young. However if anybody starts using it and let me know I will be more conservative.

Regards and thanks for your interest in AXEL,

Stéphane S.
---

[0] the AXEL wiki home shows the current roadmap https://github.com/ssire/axel/wiki
[1] https://github.com/ssire/axel/tags
[2] https://github.com/ssire/axel
[3] http://ssire.github.io/axel/docs/howto-plugins.html
[4] http://ssire.github.io/axel/docs/howto-filters.html
[5] https://github.com/ssire/axel/wiki/Wrapped-set (in progress)
[6] http://ssire.github.io/axel-forms/
[7] http://ssire.github.io/axel/examples/tutorial/tutorial.xhtml
Reply all
Reply to author
Forward
0 new messages