Re: [Xsltforms-support] A new way for configuration and extensibility
Brought to you by:
alain-couthures
|
From: Javier D. <jd...@ge...> - 2010-01-12 20:21:29
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello,<br>
<br>
I put before "if (properties.doc) {" line the following:<br>
<br>
<tt> if (!properties.doc) {<br>
properties.setDoc(properties.srcXML);<br>
}</tt><br>
<br>
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?<br>
<br>
After that, I have examined the code and I see that a copy of the
localization config xsl is done in line 532:<br>
var filename =
"config_" + lan + ".xsl";<br>
Core.loadProperties(properties, filename);<br>
<br>
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.<br>
<br>
I also see an error in language list of js:<br>
<br>
langs : ["cz", "de", "en_uk", "es", "fr" , "gl", "it", "ja", "nb_no",
"nl", "nn_no", "pt", "ro", "ru", "si", "sk"],<br>
<br>
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.<br>
<br>
Best Regards,<br>
Javier<br>
<br>
Javier Díaz escribió:
<blockquote cite="mid:4B4...@ge..." type="cite">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
Hello,<br>
<br>
I have updated my xsltforms installation to the last version, and I'm
trying to understand how new configuration files work.<br>
<br>
It seems that xsltforms.xsl include config.xsl and it seems it works
ok, loading always the localization message of this xsl.<br>
<br>
But It seems the rest of the xsl configs are never used. I see they are
only used in xsltforms.js:<br>
<br>
<tt> get : function(key) {<br>
var properties =
$("xf-instance-config").xfElement;<br>
<b> if (properties.doc) {</b><br>
if (Language == "navigator" ||
Language !=
properties.doc.documentElement.getElementsByTagName("language")[0].firstChild.nodeValue)
{<br>
var lan = Language ==
"navigator" ? (navigator.language || navigator.userLanguage) :
properties.doc.documentElement.getElementsByTagName("language")[0].firstChild.nodeValue;<br>
lan = lan.replace("-",
"_").toLowerCase();<br>
var finded =
inArray(lan, I8N.langs);<br>
if (!finded) {<br>
ind =
lan.indexOf("_");<br>
if (ind != -1) {<br>
lan = lan.substring(0, ind);<br>
}<br>
finded =
inArray(lan, I8N.langs);<br>
}<br>
if (finded) {<br>
<b> var filename
= "config_" + lan + ".xsl";</b><br>
Core.loadProperties(properties, filename);<br>
<br>
</tt>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?<br>
<br>
Apart from this, I have a little doubt that i don't know if is related
xforms or xsltforms implementation.<br>
<br>
I have an xform with this model:<br>
<br>
<xf:model id="orden"><br>
<!--<xf:model id="orden"
schema="/opt/GEREMIAS/GRM/SPCI_T/XSD/ATLASv2/ICX-interno2.xsd">--><br>
<xf:instance><br>
... xml data ...<br>
</xf:instance><br>
<b> <xf:instance id="datos"><br>
<datos_seleccion><br>
<vct><elm>admin1</elm><elm>admin1
(cca1)</elm></vct><br>
<vct><elm>admin2</elm><elm>admin2
(cca2)</elm></vct><br>
</datos_seleccion><br>
</xf:instance></b><br>
<br>
"datos" is an auxiliar instance used with the following itemset of a
select to fill the first instance:<br>
<br>
<xf:select1 ref="/SELECCION/DATO_ELEGIDO"
appearance="compact"><br>
<xf:label>Datos</xf:label><br>
<b> <xf:itemset model="orden"
nodeset="instance('datos')/vct"></b><br>
<b> <xf:label
ref="elm[2]"></xf:label><xf:value
ref="elm[1]"></xf:value><br>
</xf:itemset></b><br>
</xf:select1><br>
<br>
It works ok but surprisingly only if I skip the root node! Is this
correct? Shouldn't be better <b>instance('datos')/datos_seleccion/vct</b>
?<br>
<br>
Best Regards,<br>
Javier<br>
<br>
COUTHURES Alain escribió:
<blockquote cite="mid:4B3...@ag..." type="cite">
<pre wrap="">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 : <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://sourceforge.net/projects/exsltforms">http://sourceforge.net/projects/exsltforms</a>). 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
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://p.sf.net/sfu/verizon-dev2dev">http://p.sf.net/sfu/verizon-dev2dev</a>
_______________________________________________
Xsltforms-support mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="mailto:Xsl...@li...">Xsl...@li...</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://lists.sourceforge.net/lists/listinfo/xsltforms-support">https://lists.sourceforge.net/lists/listinfo/xsltforms-support</a>
</pre>
</blockquote>
<pre wrap="">
<hr size="4" width="90%">
------------------------------------------------------------------------------
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
<a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/verizon-dev2dev">http://p.sf.net/sfu/verizon-dev2dev</a> </pre>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Xsltforms-support mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Xsl...@li...">Xsl...@li...</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/xsltforms-support">https://lists.sourceforge.net/lists/listinfo/xsltforms-support</a>
</pre>
</blockquote>
</body>
</html>
|