[Xsltforms-support] Label element in XForms itemset
Brought to you by:
alain-couthures
|
From: Tim T. <tim...@gm...> - 2018-10-03 22:26:28
|
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
|