Re: [Xsltforms-support] A new way for configuration and extensibility
Brought to you by:
alain-couthures
|
From: COUTHURES A. <ala...@ag...> - 2010-01-12 22:33:00
|
Hello Javier,
Thank you very much for pointing this. I was always testing with server
treatment of Accept-Language so I didn't notice...
I have rewritten some parts of this and it should work correctly with
the latest SVN version.
BTW I discovered a dirty bug about class inheritance between XDocument
and XNode when recycling. This bug cannot happen again now.
Don't hesitate to contact me again if you still have problems with that.
-Alain
> Hello,
>
> I put before "if (properties.doc) {" line the following:
>
> if (!properties.doc) {
> properties.setDoc(properties.srcXML);
> }
>
> And now it enters inside the code that loads the localization config
> xsl (and loads it ok if I have in config.xsl "navigator"). Is
> something wrong in the code? Or there is an error in my xsltforms
> local version? In this case, where should be created "properties.doc",
> to check it?
>
> After that, I have examined the code and I see that a copy of the
> localization config xsl is done in line 532:
> var filename =
> "config_" + lan + ".xsl";
>
> Core.loadProperties(properties, filename);
>
> But I see that in the next access, the doc that is loading is the
> first one instead the localization one. It may be another bug, or may
> be related with the previous issue.
>
> I also see an error in language list of js:
>
> langs : ["cz", "de", "en_uk", "es", "fr" , "gl", "it", "ja", "nb_no",
> "nl", "nn_no", "pt", "ro", "ru", "si", "sk"],
>
> there is a language named "en_uk" that doesn't have a config_en_uk.xsl
> file, while there are two files, config_en.xsl and config_en_us.xsl
> that aren't defined in the js.
>
> Best Regards,
> Javier
>
> Javier Díaz escribió:
>> Hello,
>>
>> I have updated my xsltforms installation to the last version, and I'm
>> trying to understand how new configuration files work.
>>
>> It seems that xsltforms.xsl include config.xsl and it seems it works
>> ok, loading always the localization message of this xsl.
>>
>> But It seems the rest of the xsl configs are never used. I see they
>> are only used in xsltforms.js:
>>
>> get : function(key) {
>> var properties =
>> $("xf-instance-config").xfElement;
>> * if (properties.doc) {*
>> if (Language == "navigator"
>> || Language !=
>> properties.doc.documentElement.getElementsByTagName("language")[0].firstChild.nodeValue)
>> {
>> var lan = Language ==
>> "navigator" ? (navigator.language || navigator.userLanguage) :
>> properties.doc.documentElement.getElementsByTagName("language")[0].firstChild.nodeValue;
>> lan =
>> lan.replace("-", "_").toLowerCase();
>> var finded =
>> inArray(lan, I8N.langs);
>> if (!finded) {
>> ind =
>> lan.indexOf("_");
>> if (ind != -1) {
>>
>> lan = lan.substring(0, ind);
>> }
>> finded =
>> inArray(lan, I8N.langs);
>> }
>> if (finded) {
>> * var filename
>> = "config_" + lan + ".xsl";*
>>
>> Core.loadProperties(properties, filename);
>>
>> But I can't get how to load a different xsl because properties.doc is
>> always undefined. ¿I'm missing to initialize something? ¿What is
>> properties.doc?
>>
>> Apart from this, I have a little doubt that i don't know if is
>> related xforms or xsltforms implementation.
>>
>> I have an xform with this model:
>>
>> <xf:model id="orden">
>> <!--<xf:model id="orden"
>> schema="/opt/GEREMIAS/GRM/SPCI_T/XSD/ATLASv2/ICX-interno2.xsd">-->
>> <xf:instance>
>> ... xml data ...
>> </xf:instance>
>> * <xf:instance id="datos">
>> <datos_seleccion>
>> <vct><elm>admin1</elm><elm>admin1 (cca1)</elm></vct>
>> <vct><elm>admin2</elm><elm>admin2 (cca2)</elm></vct>
>> </datos_seleccion>
>> </xf:instance>*
>>
>> "datos" is an auxiliar instance used with the following itemset of a
>> select to fill the first instance:
>>
>> <xf:select1 ref="/SELECCION/DATO_ELEGIDO"
>> appearance="compact">
>> <xf:label>Datos</xf:label>
>> * <xf:itemset model="orden"
>> nodeset="instance('datos')/vct">*
>> * <xf:label ref="elm[2]"></xf:label><xf:value
>> ref="elm[1]"></xf:value>
>> </xf:itemset>*
>> </xf:select1>
>>
>> It works ok but surprisingly only if I skip the root node! Is this
>> correct? Shouldn't be better *instance('datos')/datos_seleccion/vct* ?
>>
>> Best Regards,
>> Javier
>>
>> COUTHURES Alain escribió:
>>> Hello,
>>>
>>> Extensibility is now to be considered for XSLTForms. That's why, with
>>> the latest SVN version, it is now possible for other projects to
>>> integrate their own sources files without modifying XSLTForms files.
>>>
>>> The "messages_??.properties" files called from Javascript instructions
>>> mechanism is replaced by a similar mechanism, a "config.xsl" file
>>> called, of course, from XSLT instructions.
>>>
>>> XSLT templates can be added in the "config.xsl" file: for matching
>>> templates, priority use permits to replace XSLTForms genuine templates.
>>> Because named templates cannot be replaced, calling templates have to be
>>> changed too, but it would also be possible to test whether a similar
>>> named template, "ext-*" for example, is present in the "config.xsl" file.
>>>
>>> In the "config.xsl" file, the "config" named template allows to define
>>> options (<debug/>, <nocss/>) and localization values. It also allows to
>>> specify elements, such as <script> or <link> elements, to be added, in
>>> the HTML head element, just after xsltforms.js and xsltforms.css calls.
>>>
>>> Localization can now easily be based on a server-side treatment
>>> according to HTTP Accept-Language parameter but, as before, specifying
>>> "navigator" in the "config.xsl" file, will ask the Javascript part to,
>>> as before, load localization values according to the Javascript
>>> "navigator.language" value. Localization values are now stored in a
>>> dedicated instance, itself in a dedicated model: they can also be read
>>> with XPath and, eventually set by XForms actions or controls.
>>>
>>> These new features should be very useful for other projects (such as
>>> exsltforms : http://sourceforge.net/projects/exsltforms). Don't hesitate
>>> to contact me if this is causing problems with already operational use
>>> of XSLTForms.
>>>
>>> Thanks!
>>>
>>> -Alain
>>>
>>> ------------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Verizon Developer Community
>>> Take advantage of Verizon's best-in-class app development support
>>> A streamlined, 14 day to market process makes app distribution fast and easy
>>> Join now and get one step closer to millions of Verizon customers
>>> http://p.sf.net/sfu/verizon-dev2dev
>>> _______________________________________________
>>> Xsltforms-support mailing list
>>> Xsl...@li...
>>> https://lists.sourceforge.net/lists/listinfo/xsltforms-support
>>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Verizon Developer Community
>> Take advantage of Verizon's best-in-class app development support
>> A streamlined, 14 day to market process makes app distribution fast and easy
>> Join now and get one step closer to millions of Verizon customers
>> http://p.sf.net/sfu/verizon-dev2dev
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Xsltforms-support mailing list
>> Xsl...@li...
>> https://lists.sourceforge.net/lists/listinfo/xsltforms-support
>>
|