I want to display a set of multiple-choice questions with radio buttons,
with a question above each set of radio buttons. I am using the samples
in 2.1.9 as the basis for my work. I am unable to move to the latest at
the moment, so I need to solve this in XSL so I can continue using the
files I already have.

However, with the following model and template I have two problems: 

1. I get unhandled text, which I can get rid of with an empty template.
That is to say, the text I use for the questions (an fi:label) ends up
as a child of fi:form-template and not as a child of something that can
be easily gotten for further processing.
2. I do NOT get the text mentioned above in the proper place, as an
fi:label for each fi:field.

I can get rid of the unhandled text with an empty template, but I have
been unable to get the text from each fi:item/fi:label into a para or
something for proper display.

The model:

<fd:form id="data"
xmlns:fd="http://apache.org/cocoon/forms/1.0#definition";
  xmlns:i18n="http://apache.org/cocoon/i18n/2.1";>
 
  <fd:widgets>

    <fd:field id="A">
      <fd:label>Select one from the first group:</fd:label>
      <fd:datatype base="string"/>
      <fd:selection-list>
        <fd:item value=" 1"/>
        <fd:item value=" 2"/>
      </fd:selection-list>
    </fd:field>

    <fd:field id="B">
      <fd:label>Select one from the second group:</fd:label>
      <fd:datatype base="string"/>
      <fd:selection-list>
        <fd:item value=" 1"/>
        <fd:item value=" 2"/>
      </fd:selection-list>
    </fd:field>

  </fd:widgets>

</fd:form>

The template:

<?xml version="1.0"?>
<!-- ft is the form template namespace -->
<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template";
      xmlns:fi="http://apache.org/cocoon/forms/1.0#instance";>

  <title>Questionaire</title>
  
  <content>       
    <title>This questionaire</title>
    <ft:form-template action="#{$cocoon/continuation/id}.continue"
method="POST">
      <ft:widget-label id="A"/>
      <ft:widget id="A">
        <fi:styling list-type="radio"/>
      </ft:widget>
      <ft:widget-label id="B"/>
      <ft:widget id="B">
        <fi:styling list-type="radio"/>
      </ft:widget>
      <input type="submit"/>
    </ft:form-template>
  </content>
</page>

And the output (before processing to HTML):

<html>
  <head>
    <title>Questionaire</title>
    <link title="Default Style" href="/survey4/styles/main.css"
rel="stylesheet"/>
  </head>
  <body>       
    <h2>This questionaire</h2>
    <fi:form-template
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance";
action="3c213f7a5a5b8a1d727d1f51064e444a822b4b53.continue"
method="POST">
      Select one from the first group:
      <fi:field id="data.A" state="active" required="false">
        <fi:label>Select one from the first group:</fi:label>
        <fi:selection-list>
          <fi:item value=" 1"><fi:label> 1</fi:label></fi:item>
          <fi:item value=" 2"><fi:label> 2</fi:label></fi:item>
        </fi:selection-list>
        <fi:datatype type="string"/>
        <fi:styling list-type="radio"/>
      </fi:field>
      Select one from the second group:
      <fi:field id="data.B" state="active" required="false">
        <fi:label>Select one from the second group:</fi:label>
        <fi:selection-list>
          <fi:item value=" 1"><fi:label> 1</fi:label></fi:item>
          <fi:item value=" 2"><fi:label> 2</fi:label></fi:item>
        </fi:selection-list>
        <fi:datatype type="string"/>
        <fi:styling list-type="radio"/>
      </fi:field>
      <input type="submit"/>
    </fi:form-template>
  </body>
</html>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to