Tim,
Firefox-only issues are usually caused by its XSLT engine not supporting
the namespace axis. A trick is necessary for XSLTForms to get the
namespaceURI from the prefix: adding some dummy attribute, such as
bf:dummy="dummy", at the document element should be enough. With this
trick, your test forms are working for me with Firefox too.
Subforms mechanism in XSLTForms is merging models and ignoring already
existing instances. Without any declared model, XSLTForms is actually
declaring a default one. For unit tests, it might be interesting to
declare the main models and the main instances used in the subform just
to be able to run it independently.
Thank you for your feedback!
--Alain
Le 09/07/2015 06:29, Tim Thompson a écrit :
Tried to send this to the list with an attachment, but was bounced.
Sending again without it. --Tim
---------- Forwarded message ----------
From: *Tim Thompson* <[email protected] <mailto:[email protected]>>
Date: Thu, Jul 9, 2015 at 12:25 AM
Subject: Namespaces in subforms (Firefox)
To: Alain Couthures <[email protected]
<mailto:[email protected]>>
Cc: [email protected]
<mailto:[email protected]>
Alain,
The "not well-formed" issue in Firefox seems to have been caused by an
external JavaScript library that I was using, so I'll have to
investigate that myself.
However, I did discover another issue in Firefox that may or may not
be a bug.
My understanding of subforms in XSLTForms, as Eric van der Vlist
explains it, is that "XSLTForms doesn’t isolate the models from the
master form and its subform and it is possible to access directly to
any instance of the master form from the subforms." By that token, it
should not be necessary to repeat instance data in a subform model, is
that correct? The subform controls can be bound directly to the
mainform instances.
A couple of basic tests seems to confirm that this is the case (using
your writers/books example). Test 1 works in Firefox, Chrome, and IE.
But if namespaced elements are used in the mainform instance, as in
Test 2, this pattern causes Firefox to fail. If the model element is
uncommented in Subform 2, then Firefox loads the subform correctly.
So, is a local model always necessary in the subform, or is this an
issue with Firefox? Tests are also attached.
Thanks again,
Tim
Test 1 (no namespaced instance elements)
Mainform
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:bf="http://bibframe.org/vocab/"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<title>Writers (Subforms)</title>
<xforms:model>
<xforms:instance xmlns="">
<Writers>
<Writer firstname="Albert" lastname="Camus"
selected="false">
<Book year="1938" title="Caligula"/>
<Book year="1942" title="L'étranger"/>
<Book year="1947" title="La peste"/>
<Book year="1951" title="L'homme révolté"/>
</Writer>
</Writers>
</xforms:instance>
</xforms:model>
</head>
<body>
<h3>Writers (Subforms)</h3>
<xforms:repeat nodeset="Writer" appearance="compact">
<p>
<xforms:output ref="@firstname"/> <xforms:output
ref="@lastname"/> 
<xforms:trigger>
<xforms:label><xforms:output value="choose(@selected !=
'true','Show','Hide')"/> books</xforms:label>
<xforms:action ev:event="DOMActivate">
<xforms:load if="@selected != 'true'" show="embed" targetid="subform"
resource="test1-subform.xhtml"/>
<xforms:unload if="@selected = 'true'" targetid="subform"/>
<xforms:setvalue ref="@selected" value=". != 'true'"/>
</xforms:action>
</xforms:trigger>
<xforms:group id="subform"/>
</p>
</xforms:repeat>
</body>
</html>
Subform
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:bf="http://bibframe.org/vocab/"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<title>Books</title>
<!--<xforms:model>
<xforms:instance>
<Books>
<Book year="2013" title="XForms with XSLTForms"/>
</Books>
</xforms:instance>
</xforms:model>-->
</head>
<body>
<xforms:repeat nodeset="Book">
<xforms:output value="@year"/> - <xforms:output
value="@title"/>
</xforms:repeat>
</body>
</html>
Test 2
Mainform
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:bf="http://bibframe.org/vocab/"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<title>Writers (Subforms)</title>
<xforms:model>
<xforms:instance>
<bf:Writers>
<bf:Writer firstname="Albert" lastname="Camus"
selected="false">
<bf:Book year="1938" title="Caligula"/>
<bf:Book year="1942" title="L'étranger"/>
<bf:Book year="1947" title="La peste"/>
<bf:Book year="1951" title="L'homme révolté"/>
</bf:Writer>
</bf:Writers>
</xforms:instance>
</xforms:model>
</head>
<body>
<h3>Writers (Subforms)</h3>
<xforms:repeat nodeset="bf:Writer" appearance="compact">
<p>
<xforms:output ref="@firstname"/> <xforms:output
ref="@lastname"/> 
<xforms:trigger>
<xforms:label><xforms:output value="choose(@selected !=
'true','Show','Hide')"/> books</xforms:label>
<xforms:action ev:event="DOMActivate">
<xforms:load if="@selected != 'true'" show="embed" targetid="subform"
resource="test2-subform.xhtml"/>
<xforms:unload if="@selected = 'true'" targetid="subform"/>
<xforms:setvalue ref="@selected" value=". != 'true'"/>
</xforms:action>
</xforms:trigger>
<xforms:group id="subform"/>
</p>
</xforms:repeat>
</body>
</html>
Subform
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:bf="http://bibframe.org/vocab/"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<title>Books</title>
<!--<xforms:model>
<xforms:instance>
<bf:Books>
<bf:Book year="2013" title="XForms with XSLTForms"/>
</bf:Books>
</xforms:instance>
</xforms:model>-->
</head>
<body>
<xforms:repeat nodeset="bf:Book">
<xforms:output value="@year"/> - <xforms:output
value="@title"/>
</xforms:repeat>
</body>
</html>
--
Tim A. Thompson
Metadata Librarian (Spanish/Portuguese Specialty)
Princeton University Library
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support