0

我必须为表格中的每一行创建一个复选框,如下面的 xslt 中的。

以下代码创建一个复选框:

<xsl:for-each select="Sequence/Script">
<Input Type="CheckBox" RUNAT="Server">
<xsl:attribute name="id">chkItem<xsl:value-of select="Name"/>
</xsl:attribute>
</Input>
<xsl:value-of select="Name"/>
</xsl:for-each>

我用这个来测试上面的代码:

但我想创建多个具有相同名称的复选框,例如

name
name1
name2
name3
.
.
.
.
.
.
nameN

I need to have names and id like the above to make operations on this check box using java script  easier.

更新 :

XML:

<Root>
  <AppConfig CategoryDepth="3" SelectedPage="CIMtrek_SelectedPage" ParentID="CIMtrek_ParentID" LstParm="CIMtrek_LstParm" SearchParm="CIMtrek_SearchParm" isSearch="CIMtrek_Search_No" ViewName="CIMtrek_Compliance_Daily_Shipments_Case_Pack_Update" />
  <ColumnHeader Header="Seq Num" />
  <ColumnHeader Header="Schedule Name" />
  <ColumnHeader Header="PO #" />
  <ColumnHeader Header="Ready Date" />
  <ColumnHeader Header="Cancel Date" />
  <ColumnHeader Header="Scheduled Pick Up Date" />
  <ColumnHeader Header="Scheduled Pick Up Time" />
  <ColumnHeader Header="Pallets" />
  <ColumnHeader Header="Cases" />
  <ColumnHeader Header="Pieces" />
  <ColumnHeader Header="Actual P/U Date" />
  <ColumnHeader Header="Actual P/U Time" />
  <ColumnHeader Header="Labels Printed?" />
  <ColumnHeader Header="Plant Contact" />
  <ColumnHeader Header="Missed P/U Comments" />
  <ColumnHeader Header="MY MENU" />
  <Params Param="MY PARM" />
  <Search Search="Status|[T1].[CIMtrek_daily_status] " />
  <Search Search="Load #|[T1].[CIMtrek_daily_LoadNum] " />
  <Search Search="Seq Num|[T1].[CIMtrek_SeqNum] " />
  <Search Search="Schedule Name|[T1].[CIMtrek_daily_schedule_name] " />
  <Search Search="PO #|[T1].[CIMtrek_daily_PONumbers] " />
  <Search Search="Ready Date|[T1].[CIMtrek_daily_RDate] " />
  <Search Search="Cancel Date|[T1].[CIMtrek_daily_CDate] " />
  <Search Search="Scheduled Pick Up Date|[T1].[CIMtrek_daily_SPUD] " />
  <Search Search="Scheduled Pick Up Time|[T1].[CIMtrek_daily_SPUT] " />
  <Search Search="Pallets|[T1].[CIMtrek_daily_pallet_totals] " />
  <Search Search="Cases|[T1].[CIMtrek_daily_cases] " />
  <Search Search="Pieces|[T1].[CIMtrek_daily_pieces] " />
  <Search Search="Actual P/U Date|[T1].[CIMtrek_daily_ADate] " />
  <Search Search="Actual P/U Time|[T1].[CIMtrek_daily_ATime] " />
  <Search Search="Labels Printed?|[T1].[CIMtrek_daily_labels] " />
  <Search Search="Plant Contact|[T1].[CIMtrek_daily_contact] " />
  <Search Search="Missed P/U Comments|[T1].[CIMtrek_daily_MPcomments] " />
  <Search Search="MY SEARCH|Search" />
  <Data CIMtrek_COUNT="0" CIMtrek_COUNT_Level="3">
    <Data Row="1" UnqCimID="6105E973-3E07-4A6B-95C3-8A73FCD5BBF9" CIMtrek_SeqNum="12" CIMtrek_CIMtrekUniqueID="3432" CIMtrek_Cim_FormName="Compliance_Daily_Shipments" CIMtrek_daily_schedule_name="c605445k" CIMtrek_daily_PONumbers="5908013035" CIMtrek_daily_RDate="11/09/2012" CIMtrek_daily_CDate="11/15/2012" CIMtrek_daily_SPUD="09-Nov-12 12:00:00 AM" CIMtrek_daily_SPUT="" CIMtrek_daily_pallet_totals="1" CIMtrek_daily_cases="" CIMtrek_daily_pieces="" CIMtrek_daily_ADate="" CIMtrek_daily_ATime="" CIMtrek_daily_labels="" CIMtrek_daily_contact="" CIMtrek_daily_MPcomments="" />
    <Data Row="2" UnqCimID="13256F61-ABA8-404F-95E1-35948072D827" CIMtrek_SeqNum="13" CIMtrek_CIMtrekUniqueID="3456" CIMtrek_Cim_FormName="Compliance_Daily_Shipments" CIMtrek_daily_schedule_name="c703845a" CIMtrek_daily_PONumbers="1403182831" CIMtrek_daily_RDate="11/09/2012" CIMtrek_daily_CDate="11/15/2012" CIMtrek_daily_SPUD="09-Nov-12 12:00:00 AM" CIMtrek_daily_SPUT="" CIMtrek_daily_pallet_totals="1" CIMtrek_daily_cases="0" CIMtrek_daily_pieces="142" CIMtrek_daily_ADate="" CIMtrek_daily_ATime="" CIMtrek_daily_labels="" CIMtrek_daily_contact="" CIMtrek_daily_MPcomments="" />
    <Data Row="3" UnqCimID="7EED00B5-78D7-4725-A4B5-C5367928F381" CIMtrek_SeqNum="14" CIMtrek_CIMtrekUniqueID="3441" CIMtrek_Cim_FormName="Compliance_Daily_Shipments" CIMtrek_daily_schedule_name="c703845k" CIMtrek_daily_PONumbers="0953341466" CIMtrek_daily_RDate="11/09/2012" CIMtrek_daily_CDate="11/15/2012" CIMtrek_daily_SPUD="09-Nov-12 12:00:00 AM" CIMtrek_daily_SPUT="" CIMtrek_daily_pallet_totals="1" CIMtrek_daily_cases="" CIMtrek_daily_pieces="" CIMtrek_daily_ADate="" CIMtrek_daily_ATime="" CIMtrek_daily_labels="" CIMtrek_daily_contact="" CIMtrek_daily_MPcomments="" />
    <Data Row="4" UnqCimID="F762B1C4-6DF7-4DC5-9EA5-6B3375033266" CIMtrek_SeqNum="15" CIMtrek_CIMtrekUniqueID="3442" CIMtrek_Cim_FormName="Compliance_Daily_Shipments" CIMtrek_daily_schedule_name="c703845b" CIMtrek_daily_PONumbers="1702274479" CIMtrek_daily_RDate="11/09/2012" CIMtrek_daily_CDate="11/15/2012" CIMtrek_daily_SPUD="09-Nov-12 12:00:00 AM" CIMtrek_daily_SPUT="" CIMtrek_daily_pallet_totals="1" CIMtrek_daily_cases="" CIMtrek_daily_pieces="" CIMtrek_daily_ADate="" CIMtrek_daily_ATime="" CIMtrek_daily_labels="" CIMtrek_daily_contact="" CIMtrek_daily_MPcomments="" />
    <Data Row="5" UnqCimID="7DF9C660-D530-4823-AB7B-F9F3A587FD78" CIMtrek_SeqNum="16" CIMtrek_CIMtrekUniqueID="3449" CIMtrek_Cim_FormName="Compliance_Daily_Shipments" CIMtrek_daily_schedule_name="c602345a" CIMtrek_daily_PONumbers="8703182710 " CIMtrek_daily_RDate="11/09/2012" CIMtrek_daily_CDate="11/15/2012" CIMtrek_daily_SPUD="09-Nov-12 12:00:00 AM" CIMtrek_daily_SPUT="" CIMtrek_daily_pallet_totals="1" CIMtrek_daily_cases="4" CIMtrek_daily_pieces="103" CIMtrek_daily_ADate="" CIMtrek_daily_ATime="" CIMtrek_daily_labels="" CIMtrek_daily_contact="" CIMtrek_daily_MPcomments="" />
    <Data Row="6" UnqCimID="1B80BF88-9873-415D-9053-2929227B96B9" CIMtrek_SeqNum="17" CIMtrek_CIMtrekUniqueID="3419" CIMtrek_Cim_FormName="Compliance_Daily_Shipments" CIMtrek_daily_schedule_name="c602345k" CIMtrek_daily_PONumbers="6253222783" CIMtrek_daily_RDate="11/09/2012" CIMtrek_daily_CDate="11/15/2012" CIMtrek_daily_SPUD="09-Nov-12 12:00:00 AM" CIMtrek_daily_SPUT="" CIMtrek_daily_pallet_totals="1" CIMtrek_daily_cases="" CIMtrek_daily_pieces="" CIMtrek_daily_ADate="" CIMtrek_daily_ATime="" CIMtrek_daily_labels="" CIMtrek_daily_contact="" CIMtrek_daily_MPcomments="" />
    <Data Row="7" UnqCimID="63C0E5B5-2454-4C54-A707-A25F2DB73C31" CIMtrek_SeqNum="18" CIMtrek_CIMtrekUniqueID="3418" CIMtrek_Cim_FormName="Compliance_Daily_Shipments" CIMtrek_daily_schedule_name="c602345b" CIMtrek_daily_PONumbers="3251819273" CIMtrek_daily_RDate="11/09/2012" CIMtrek_daily_CDate="11/15/2012" CIMtrek_daily_SPUD="09-Nov-12 12:00:00 AM" CIMtrek_daily_SPUT="" CIMtrek_daily_pallet_totals="1" CIMtrek_daily_cases="" CIMtrek_daily_pieces="" CIMtrek_daily_ADate="" CIMtrek_daily_ATime="" CIMtrek_daily_labels="" CIMtrek_daily_contact="" CIMtrek_daily_MPcomments="" />
    <Data Row="8" UnqCimID="F4D78B25-02AD-40E9-A337-552785FD9ECC" CIMtrek_SeqNum="19" CIMtrek_CIMtrekUniqueID="3455" CIMtrek_Cim_FormName="Compliance_Daily_Shipments" CIMtrek_daily_schedule_name="c703445a" CIMtrek_daily_PONumbers="8553014885" CIMtrek_daily_RDate="11/09/2012" CIMtrek_daily_CDate="11/15/2012" CIMtrek_daily_SPUD="09-Nov-12 12:00:00 AM" CIMtrek_daily_SPUT="" CIMtrek_daily_pallet_totals="1" CIMtrek_daily_cases="1" CIMtrek_daily_pieces="172" CIMtrek_daily_ADate="" CIMtrek_daily_ATime="" CIMtrek_daily_labels="" CIMtrek_daily_contact="" CIMtrek_daily_MPcomments="" />
    <Data Row="9" UnqCimID="040BF0F1-CF3E-46F8-9C20-6075E3DBA049" CIMtrek_SeqNum="2" CIMtrek_CIMtrekUniqueID="3415" CIMtrek_Cim_FormName="Compliance_Daily_Shipments" CIMtrek_daily_schedule_name="c601045k" CIMtrek_daily_PONumbers="3403154247" CIMtrek_daily_RDate="11/09/2012" CIMtrek_daily_CDate="11/15/2012" CIMtrek_daily_SPUD="09-Nov-12 12:00:00 AM" CIMtrek_daily_SPUT="" CIMtrek_daily_pallet_totals="1" CIMtrek_daily_cases="" CIMtrek_daily_pieces="" CIMtrek_daily_ADate="" CIMtrek_daily_ATime="" CIMtrek_daily_labels="" CIMtrek_daily_contact="" CIMtrek_daily_MPcomments="" />
    <Data Row="10" UnqCimID="02BCB2ED-CCB9-4F65-B841-DE03DCB897EB" CIMtrek_SeqNum="20" CIMtrek_CIMtrekUniqueID="3440" CIMtrek_Cim_FormName="Compliance_Daily_Shipments" CIMtrek_daily_schedule_name="c703445b" CIMtrek_daily_PONumbers="6652205349" CIMtrek_daily_RDate="11/09/2012" CIMtrek_daily_CDate="11/15/2012" CIMtrek_daily_SPUD="09-Nov-12 12:00:00 AM" CIMtrek_daily_SPUT="" CIMtrek_daily_pallet_totals="1" CIMtrek_daily_cases="" CIMtrek_daily_pieces="" CIMtrek_daily_ADate="" CIMtrek_daily_ATime="" CIMtrek_daily_labels="" CIMtrek_daily_contact="" CIMtrek_daily_MPcomments="" />
  </Data>
</Root>

not able to update with xslt as it is too big

如何在 xslt 中执行此操作。请帮我完成这件事。

最好的祝福。

多个复选框

4

2 回答 2

1

检查这个,你可以理解你错过了什么

<xsl:for-each select="Sequence/Script"> 
    <xsl:element name="input">
      <xsl:attribute name="type">checkbox</xsl:attribute>
      <xsl:attribute name="value"><xsl:value-of select="Name"/></xsl:attribute>
    </xsl:element>
    <xsl:value-of select="Name"/>
<br />  
</xsl:for-each>  

这是从 XSL 样式表输出 HTML的链接

于 2013-01-01T09:18:03.547 回答
1

这是一个更短更紧凑的解决方案:

<xsl:template match="Sequence/Script"> 
  <input type="checkbox" value="{Name}"/>
  <xsl:value-of select="Name"/><br />
</xsl:template>  
于 2013-01-01T17:13:04.560 回答