我在忽略大小写时获取值时遇到问题。发生的情况是,当用户输入有关他们使用的设备的数据时,他们可能会输入 38e135 作为设备编号,但稍后在表单中他们可能会输入 38E135。当我遍历设备 ID 时,我需要将它们视为一个。
当我尝试这个时,我将它们作为两个不同的设备编号。
<xsl:key name="distinctEquipNum" match="//EquipmentNumber" use="."/>
当我尝试使用翻译功能时,我只得到其中一个。
<xsl:key name="distinctEquipNum" match="//EquipmentNumber" use="translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
这是我用来获取数据的循环
<xsl:for-each select=".//EquipmentNumber[generate-id() = generate-id(key('distinctEquipNum', .)[1])]">
<xsl:variable name="equipNum" select="."></xsl:variable>
<td><xsl:value-of select="$equipNum"/></td>
有没有办法让我遍历设备编号并忽略大小写?
这是我正在使用的 XML 示例,
<Timesheet>
<Equipment>
<EquipmentWorkOrder>
<EquipmentWorkOrderNumber>220923134</EquipmentWorkOrderNumber>
<EquipmentDetail>
<EquipmentMileage>1123</EquipmentMileage>
<EquipmentHourMeter>Hour Meter</EquipmentHourMeter>
<EquipmentType>Bucket truck</EquipmentType>
<EquipmentNumber>38e135</EquipmentNumber>
<MondayHours>6</MondayHours>
<TuesdayHours>Tuesday</TuesdayHours>
<WednesdayHours>1</WednesdayHours>
<ThursdayHours>Thursday</ThursdayHours>
<FridayHours>Friday</FridayHours>
<SaturdayHours>Saturday</SaturdayHours>
<SundayHours>Sunday</SundayHours>
</EquipmentDetail>
</EquipmentWorkOrder>
<EquipmentWorkOrder>
<EquipmentWorkOrderNumber>220923378</EquipmentWorkOrderNumber>
<EquipmentDetail>
<EquipmentMileage>72155</EquipmentMileage>
<EquipmentHourMeter>Hour Meter</EquipmentHourMeter>
<EquipmentType>4x4 Pickup</EquipmentType>
<EquipmentNumber>2a3557</EquipmentNumber>
<MondayHours>6</MondayHours>
<TuesdayHours>3</TuesdayHours>
<WednesdayHours>5</WednesdayHours>
<ThursdayHours>2</ThursdayHours>
<FridayHours>Friday</FridayHours>
<SaturdayHours>2</SaturdayHours>
<SundayHours>Sunday</SundayHours>
</EquipmentDetail>
</EquipmentWorkOrder>
<EquipmentWorkOrder>
<EquipmentWorkOrderNumber>220923134</EquipmentWorkOrderNumber>
<EquipmentDetail>
<EquipmentMileage>Mileage</EquipmentMileage>
<EquipmentHourMeter>133</EquipmentHourMeter>
<EquipmentType>Back Hoe</EquipmentType>
<EquipmentNumber>122</EquipmentNumber>
<MondayHours>Monday</MondayHours>
<TuesdayHours>8</TuesdayHours>
<WednesdayHours>3</WednesdayHours>
<ThursdayHours>Thursday</ThursdayHours>
<FridayHours>Friday</FridayHours>
<SaturdayHours>Saturday</SaturdayHours>
<SundayHours>Sunday</SundayHours>
</EquipmentDetail>
</EquipmentWorkOrder>
<EquipmentWorkOrder>
<EquipmentWorkOrderNumber>220925520</EquipmentWorkOrderNumber>
<EquipmentDetail>
<EquipmentMileage>72155</EquipmentMileage>
<EquipmentHourMeter>Hour Meter</EquipmentHourMeter>
<EquipmentType>Bucket truck</EquipmentType>
<EquipmentNumber>38E135</EquipmentNumber>
<MondayHours>6</MondayHours>
<TuesdayHours>Tuesday</TuesdayHours>
<WednesdayHours>1</WednesdayHours>
<ThursdayHours>Thursday</ThursdayHours>
<FridayHours>Friday</FridayHours>
<SaturdayHours>Saturday</SaturdayHours>
<SundayHours>Sunday</SundayHours>
</EquipmentDetail>
</EquipmentWorkOrder>
</Equipment></Timesheet>