Frank MW wrote:
Hi all,
I'm trying to get the values for a selection-list from an xml - file,
but there is not much documentation around and I haven't found a fitting
hint yet. That's what I tried rather intuitively:
<fd:field id="test" required="false">
<fd:datatype base="string"></fd:datatype>
<fd:label>Clause - Test</fd:label>
<fd:selection-list src="forms/auswahl.xml" value-path="option"
list-path="auswahl" dynamic="true"></fd:selection-list>
</fd:field>
with auswahl.xml:
<auswahl>
<option>nested clause</option>
<option>if-clause</option>
<option>adverbial clause</option>
</auswahl>
How do I have to do that? Or if there is documentation on it, could you
provide me with the link, since I couldn't find it. What I need is not
in here:
http://cocoon.apache.org/2.1/userdocs/widgetconcepts/selectionlists.html
since it just says:
<fd:datatype base="string"/>
<fd:selection-list src="cocoon:/mychoices.xml" dynamic="true"/>
But how do I specify the path in the xml-file?
The docs say that the format of the XML file has to match that of the
normal inline fd:selection-list declaration:
<fd:selection-list>
<fd:item value="value1">
<fd:label>Label1</fd:label>
</fd:item>
<fd:item value="value2" />
</fd:selection-list>
The value-path and list-path attributes only apply to the flow-jxpath
implementation, not when you're referencing an external XML file.
To get your file into that format you can use a cocoon:/ URI to
reference a pipeline which transforms it into the correct format via XSLT.
=== Form definition: ===
<fd:selection-list src="cocoon:/mychoices-selection-list.xml"
dynamic="true" />
=== Sitemap: ===
<map:match pattern="mychoices-selection-list.xml">
<map:generate src="mychoices.xml" />
<map:transform src="mychoices-to-selection-list.xsl" />
<map:serialize type="xml" />
</map:match>
=== mychoices-to-selection-list.xsl: ===
<xsl:stylesheet ...>
<xsl:template match="auswahl">
<fd:selection-list>
<xsl:apply-templates />
</fd:selection-list>
</xsl:template>
<xsl:template match="option">
<fd:item value="{.}" />
</xsl:template>
</xsl:stylesheet>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]