Re: [Xsltforms-support] Label element in XForms itemset
Brought to you by:
alain-couthures
From: Alain C. <ala...@ag...> - 2018-10-05 16:44:49
|
Tim, In XForms 1.1, at https://www.w3.org/TR/xforms11/#ui-selection-commonelems-itemset, "The node-set that holds the available choices is specified via the Node Set Binding.". In XForms 2.0, at https://www.w3.org/community/xformsusers/wiki/XForms_2.0#The_item_Element, "The sequence that holds the available choices is specified via the Sequence Binding.". So, xf:itemset/xf:label/xf:output/@value is not valid XForms from my point of view. With XPath 2.0 at least, xf:itemset/xf:label/@ref="title/substring(., 1, 50)" would generate the correct sequence for your example. Sorry but Fleur engine is not yet supported in XSLTForms... --Alain Le 04/10/2018 à 00:25, Tim Thompson a écrit : > Alain, > > I would like to use xf:output/@value with an XPath expression to > generate the contents of an xf:itemset label inside an xf:select1. > This should be valid in XForms, unless I am mistaken. However, in > XSLTForms 1.0, I get an error when I try to do this: > > TypeError: Cannot read property 'xfElement' of null > at XsltForms_output.XsltForms_element.init (xsltforms.js:9319) > at new XsltForms_output (xsltforms.js:10565) > at xsltforms_initImpl (itemset-label-test.xhtml:42) > at xsltforms_init (itemset-label-test.xhtml:76) > > See attached form and data file (also pasted below) to reproduce the > issue. Thanks in advance. > > Form: > > <?xml-stylesheet href="xsltforms/build/xsltforms.xsl" type="text/xsl"?> > <?xsltforms-options debug="yes"?> > <?css-conversion no?> > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:xf="http://www.w3.org/2002/xforms"> > <head> > <title>Itemset test</title> > <meta http-equiv="Content-Type" content="text/html; > charset=utf-8" /> > > <xf:model> > <xf:instance> > <data xmlns=""> > <current/> > </data> > </xf:instance> > </xf:model> > > <xf:model id="entries"> > <xf:instance src="entries.xml"/> > </xf:model> > > </head> > <body> > <div class="container-fluid wrapper"> > <xf:select1 ref="/data/current" appearance="minimal" > incremental="true"> > <xf:label>Select a title to compare: </xf:label> > <xf:itemset model="entries" ref="/data/entry"> > <!-- Works with xf:label/@ref --> > <!-- <xf:label ref="title"/> --> > <!-- But not with nested xf:label/xf:output/@value --> > <xf:label> > <xf:output value="substring(title, 1, 50)"/> > </xf:label> > <xf:value ref="identifier"/> > </xf:itemset> > </xf:select1> > <xf:output ref="/data/current"> > <xf:label>Current title: </xf:label> > </xf:output> > </div> > <br /> > </body> > </html> > > Data: > > <?xml version="1.0" encoding="UTF-8"?> > <data> > <entry> > <identifier>2017387103</identifier> > <title>Una famiglia tra Siena e l'Europa : i Montucci, > 1762-1877 /famiglia tra Siena e l'Europa : i Montucc...</title> > </entry> > <entry> > <identifier>2017452585</identifier> > <title>Tipologie e modalità della mediazione nella Grecia > antica : le fonti letterarie /Tipologie e modalit...</title> > </entry> > <entry> > <identifier>2017452511</identifier> > <title>Identità sotto chiave : lingua e stile nel teatro di > Saverio La Ruina /Identità sotto chiave : lingu...</title> > </entry> > </data> > > > Best regards, > Tim > > -- > Tim A. Thompson > Discovery Metadata Librarian > Yale University Library > > > > > > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support |