Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Output html controls - dynamic control name

I'd like to output html controls using xslt, but I need to be able to name the controls so that I can get at them when the form posts back.

I'd like to be able to name the radio button "action_" + _case_id.

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="data.xsl"?>
<NewDataSet>
  <Cases>
    <Case>
      <case_id>30</case_id>
    </Case>
  <Cases>
</NewDataSet>

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
     <div class="your_action">
      Your action:<br />
      <input type="radio" name="?" value="No" checked ="true"/> nothing to report<br />
      <input type="radio" name="?" value="Yes" /> memo to follow
    </div>
  </xsl:template>
</xsl:stylesheet>
like image 480
Dave Harding Avatar asked Apr 08 '26 22:04

Dave Harding


1 Answers

Use:

<input type="radio" name="{concat('action_', /*/*/*/case_id)}"
 value="No" checked ="true"/>

In case your xml document changes it may be necessary to substitute the "*" chars above with more detailed location steps.

like image 135
Dimitre Novatchev Avatar answered Apr 11 '26 14:04

Dimitre Novatchev