1
我在獲取值時忽略大小寫時遇到問題。會發生什麼情況是,當用戶輸入他們使用的設備數據時,他們可能會輸入38e135作爲設備號,但後來可能會輸入38E135。當我通過設備id時,我需要將它們視爲一個整體。XSLT:處理忽略大小寫和循環
當我嘗試這個我得到他們作爲兩個不同的設備號碼。
<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>
這正是我需要的,非常感謝伊恩。 – inosu812 2013-03-06 16:29:45