0

XSLT の 1 つにビジネス ルールの変更がありましたが、その処理方法がわかりません。以下の XML を見ると、従業員セクションと設備セクションがあることがわかります。従業員セクションには、day タグと TimeDetail タグにネストされた WorkOrderNumber があり、Equipment -> EquipmentWorkOrder にネストされた EquipmentWorkOrderNumber があります。

以前は WorkOrderNumber と EquipmentWorkOrderNumber の間に相関関係があるため、個別の WorkOrderNumber を取得する必要がありましたが、現在は、従業員の WorkOrderNumber セクションに存在しない追加の EquipmentWorkOrderNumber が存在する可能性があります。

値を複製せずに個別の WorkOrderNumber と EquipmentWorkOrderNumber を取得する必要があります。以下のコードの多くのバリエーションを試しましたが、実際の進歩はありませんでした。

<!-- The Key at the top --> 
<xsl:key name="distinctWoEquipWo" match="//WorkOrderNumber | //EquipmentWorkOrderNumber" use="."/>

<!-- Where I loop through the distinct values -->
<xsl:for-each select=".//WorkOrderNumber | .//EquipmentWorkOrderNumber[generate-id() = generate-id(key('distinctWoEquipWo', .)[1])]">

選択で個別の WorkOrderNumber と EquipmentWorkOrderNumber 値を取得することは可能ですか?

私が使用している XML は次のとおりです。

<?xml-stylesheet type="text/xsl" href="TemplateTest.xsl"?>
<Timesheet>
<WeekEnding>Apr 28, 2013</WeekEnding>
<TeamMember>
    <EmployeeNumber>AB00910</EmployeeNumber>
    <EmployeeName>Demo, Derek</EmployeeName>
    <EmployeeClass>F</EmployeeClass>
    <Monday>
        <TimeDetail>
            <StartTime>Start</StartTime>
            <StopTime>Stop</StopTime>
            <WorkOrderNumber>4812537</WorkOrderNumber>
            <RegularHoursStartTime>Start</RegularHoursStartTime>
            <RegularHoursStopTime>Stop</RegularHoursStopTime>
            <RegularHoursStartTime2>Start</RegularHoursStartTime2>
            <RegularHoursStopTime2>Stop</RegularHoursStopTime2>
            <RegularHours>9</RegularHours>
            <OverTimeStartTime>Start</OverTimeStartTime>
            <OverTimeStopTime>Stop</OverTimeStopTime>
            <OverTimeStartTime2>Start</OverTimeStartTime2>
            <OverTimeStopTime2>Stop</OverTimeStopTime2>
            <OverTimeHours>Over Time</OverTimeHours>
            <OtherStartTime>Start</OtherStartTime>
            <OtherStopTime>Stop</OtherStopTime>
            <OtherStartTime2>Start</OtherStartTime2>
            <OtherStopTime2>Stop</OtherStopTime2>
            <OtherHours>Other</OtherHours>
            <PerDiem>NO</PerDiem>
            <Notes>Notes</Notes>
        </TimeDetail>
    </Monday>
    <Tuesday>
        <TimeDetail>
            <StartTime>Start</StartTime>
            <StopTime>Stop</StopTime>
            <WorkOrderNumber>4812537</WorkOrderNumber>
            <RegularHoursStartTime>Start</RegularHoursStartTime>
            <RegularHoursStopTime>Stop</RegularHoursStopTime>
            <RegularHoursStartTime2>Start</RegularHoursStartTime2>
            <RegularHoursStopTime2>Stop</RegularHoursStopTime2>
            <RegularHours>12</RegularHours>
            <OverTimeStartTime>Start</OverTimeStartTime>
            <OverTimeStopTime>Stop</OverTimeStopTime>
            <OverTimeStartTime2>Start</OverTimeStartTime2>
            <OverTimeStopTime2>Stop</OverTimeStopTime2>
            <OverTimeHours>Over Time</OverTimeHours>
            <OtherStartTime>Start</OtherStartTime>
            <OtherStopTime>Stop</OtherStopTime>
            <OtherStartTime2>Start</OtherStartTime2>
            <OtherStopTime2>Stop</OtherStopTime2>
            <OtherHours>Other</OtherHours>
            <PerDiem>NO</PerDiem>
            <Notes>Notes</Notes>
        </TimeDetail>
    </Tuesday>
    <Wednesday>
        <TimeDetail>
            <StartTime>Start</StartTime>
            <StopTime>Stop</StopTime>
            <WorkOrderNumber>4812537</WorkOrderNumber>
            <RegularHoursStartTime>Start</RegularHoursStartTime>
            <RegularHoursStopTime>Stop</RegularHoursStopTime>
            <RegularHoursStartTime2>Start</RegularHoursStartTime2>
            <RegularHoursStopTime2>Stop</RegularHoursStopTime2>
            <RegularHours>11</RegularHours>
            <OverTimeStartTime>Start</OverTimeStartTime>
            <OverTimeStopTime>Stop</OverTimeStopTime>
            <OverTimeStartTime2>Start</OverTimeStartTime2>
            <OverTimeStopTime2>Stop</OverTimeStopTime2>
            <OverTimeHours>Over Time</OverTimeHours>
            <OtherStartTime>Start</OtherStartTime>
            <OtherStopTime>Stop</OtherStopTime>
            <OtherStartTime2>Start</OtherStartTime2>
            <OtherStopTime2>Stop</OtherStopTime2>
            <OtherHours>Other</OtherHours>
            <PerDiem>NO</PerDiem>
            <Notes>Notes</Notes>
        </TimeDetail>
    </Wednesday>
    <Thursday>
        <TimeDetail>
            <StartTime>Start</StartTime>
            <StopTime>Stop</StopTime>
            <WorkOrderNumber>4812537</WorkOrderNumber>
            <RegularHoursStartTime>Start</RegularHoursStartTime>
            <RegularHoursStopTime>Stop</RegularHoursStopTime>
            <RegularHoursStartTime2>Start</RegularHoursStartTime2>
            <RegularHoursStopTime2>Stop</RegularHoursStopTime2>
            <RegularHours>8</RegularHours>
            <OverTimeStartTime>Start</OverTimeStartTime>
            <OverTimeStopTime>Stop</OverTimeStopTime>
            <OverTimeStartTime2>Start</OverTimeStartTime2>
            <OverTimeStopTime2>Stop</OverTimeStopTime2>
            <OverTimeHours>3</OverTimeHours>
            <OtherStartTime>Start</OtherStartTime>
            <OtherStopTime>Stop</OtherStopTime>
            <OtherStartTime2>Start</OtherStartTime2>
            <OtherStopTime2>Stop</OtherStopTime2>
            <OtherHours>Other</OtherHours>
            <PerDiem>NO</PerDiem>
            <Notes>Notes</Notes>
        </TimeDetail>
    </Thursday>
    <Friday>
        <TimeDetail>
            <StartTime>Start</StartTime>
            <StopTime>Stop</StopTime>
            <WorkOrderNumber>4812537</WorkOrderNumber>
            <RegularHoursStartTime>Start</RegularHoursStartTime>
            <RegularHoursStopTime>Stop</RegularHoursStopTime>
            <RegularHoursStartTime2>Start</RegularHoursStartTime2>
            <RegularHoursStopTime2>Stop</RegularHoursStopTime2>
            <RegularHours>0</RegularHours>
            <OverTimeStartTime>Start</OverTimeStartTime>
            <OverTimeStopTime>Stop</OverTimeStopTime>
            <OverTimeStartTime2>Start</OverTimeStartTime2>
            <OverTimeStopTime2>Stop</OverTimeStopTime2>
            <OverTimeHours>7</OverTimeHours>
            <OtherStartTime>Start</OtherStartTime>
            <OtherStopTime>Stop</OtherStopTime>
            <OtherStartTime2>Start</OtherStartTime2>
            <OtherStopTime2>Stop</OtherStopTime2>
            <OtherHours>Other</OtherHours>
            <PerDiem>NO</PerDiem>
            <Notes>Notes</Notes>
        </TimeDetail>
    </Friday>
    <Saturday />
    <Sunday />
    <CrewLeader>1</CrewLeader>
</TeamMember>
<TeamMember>
    <EmployeeNumber>BB7789A</EmployeeNumber>
    <EmployeeName>Employee, Daniel</EmployeeName>
    <EmployeeClass>AL</EmployeeClass>
    <Monday />
    <Tuesday>
        <TimeDetail>
            <StartTime>Start</StartTime>
            <StopTime>Stop</StopTime>
            <WorkOrderNumber>4812537</WorkOrderNumber>
            <RegularHoursStartTime>Start</RegularHoursStartTime>
            <RegularHoursStopTime>Stop</RegularHoursStopTime>
            <RegularHoursStartTime2>Start</RegularHoursStartTime2>
            <RegularHoursStopTime2>Stop</RegularHoursStopTime2>
            <RegularHours>12</RegularHours>
            <OverTimeStartTime>Start</OverTimeStartTime>
            <OverTimeStopTime>Stop</OverTimeStopTime>
            <OverTimeStartTime2>Start</OverTimeStartTime2>
            <OverTimeStopTime2>Stop</OverTimeStopTime2>
            <OverTimeHours>Over Time</OverTimeHours>
            <OtherStartTime>Start</OtherStartTime>
            <OtherStopTime>Stop</OtherStopTime>
            <OtherStartTime2>Start</OtherStartTime2>
            <OtherStopTime2>Stop</OtherStopTime2>
            <OtherHours>Other</OtherHours>
            <PerDiem>YES</PerDiem>
            <Notes>5xfullperdiem</Notes>
        </TimeDetail>
    </Tuesday>
    <Wednesday>
        <TimeDetail>
            <StartTime>Start</StartTime>
            <StopTime>Stop</StopTime>
            <WorkOrderNumber>4812537</WorkOrderNumber>
            <RegularHoursStartTime>Start</RegularHoursStartTime>
            <RegularHoursStopTime>Stop</RegularHoursStopTime>
            <RegularHoursStartTime2>Start</RegularHoursStartTime2>
            <RegularHoursStopTime2>Stop</RegularHoursStopTime2>
            <RegularHours>11</RegularHours>
            <OverTimeStartTime>Start</OverTimeStartTime>
            <OverTimeStopTime>Stop</OverTimeStopTime>
            <OverTimeStartTime2>Start</OverTimeStartTime2>
            <OverTimeStopTime2>Stop</OverTimeStopTime2>
            <OverTimeHours>Over Time</OverTimeHours>
            <OtherStartTime>Start</OtherStartTime>
            <OtherStopTime>Stop</OtherStopTime>
            <OtherStartTime2>Start</OtherStartTime2>
            <OtherStopTime2>Stop</OtherStopTime2>
            <OtherHours>Other</OtherHours>
            <PerDiem>YES</PerDiem>
            <Notes>5xfullperdiem</Notes>
        </TimeDetail>
    </Wednesday>
    <Thursday>
        <TimeDetail>
            <StartTime>Start</StartTime>
            <StopTime>Stop</StopTime>
            <WorkOrderNumber>4812537</WorkOrderNumber>
            <RegularHoursStartTime>Start</RegularHoursStartTime>
            <RegularHoursStopTime>Stop</RegularHoursStopTime>
            <RegularHoursStartTime2>Start</RegularHoursStartTime2>
            <RegularHoursStopTime2>Stop</RegularHoursStopTime2>
            <RegularHours>8</RegularHours>
            <OverTimeStartTime>Start</OverTimeStartTime>
            <OverTimeStopTime>Stop</OverTimeStopTime>
            <OverTimeStartTime2>Start</OverTimeStartTime2>
            <OverTimeStopTime2>Stop</OverTimeStopTime2>
            <OverTimeHours>3</OverTimeHours>
            <OtherStartTime>Start</OtherStartTime>
            <OtherStopTime>Stop</OtherStopTime>
            <OtherStartTime2>Start</OtherStartTime2>
            <OtherStopTime2>Stop</OtherStopTime2>
            <OtherHours>Other</OtherHours>
            <PerDiem>YES</PerDiem>
            <Notes>5xfullperdiem</Notes>
        </TimeDetail>
    </Thursday>
    <Friday>
        <TimeDetail>
            <StartTime>Start</StartTime>
            <StopTime>Stop</StopTime>
            <WorkOrderNumber>4812537</WorkOrderNumber>
            <RegularHoursStartTime>Start</RegularHoursStartTime>
            <RegularHoursStopTime>Stop</RegularHoursStopTime>
            <RegularHoursStartTime2>Start</RegularHoursStartTime2>
            <RegularHoursStopTime2>Stop</RegularHoursStopTime2>
            <RegularHours>Regular</RegularHours>
            <OverTimeStartTime>Start</OverTimeStartTime>
            <OverTimeStopTime>Stop</OverTimeStopTime>
            <OverTimeStartTime2>Start</OverTimeStartTime2>
            <OverTimeStopTime2>Stop</OverTimeStopTime2>
            <OverTimeHours>7</OverTimeHours>
            <OtherStartTime>Start</OtherStartTime>
            <OtherStopTime>Stop</OtherStopTime>
            <OtherStartTime2>Start</OtherStartTime2>
            <OtherStopTime2>Stop</OtherStopTime2>
            <OtherHours>Other</OtherHours>
            <PerDiem>YES</PerDiem>
            <Notes>5xfullperdiem</Notes>
        </TimeDetail>
    </Friday>
    <Saturday />
    <Sunday />
</TeamMember>
<TeamMember>
    <EmployeeNumber>CDE890</EmployeeNumber>
    <EmployeeName>Test, John</EmployeeName>
    <EmployeeClass>G</EmployeeClass>
    <Monday>
        <TimeDetail>
            <StartTime>Start</StartTime>
            <StopTime>Stop</StopTime>
            <WorkOrderNumber>4812537</WorkOrderNumber>
            <RegularHoursStartTime>Start</RegularHoursStartTime>
            <RegularHoursStopTime>Stop</RegularHoursStopTime>
            <RegularHoursStartTime2>Start</RegularHoursStartTime2>
            <RegularHoursStopTime2>Stop</RegularHoursStopTime2>
            <RegularHours>9</RegularHours>
            <OverTimeStartTime>Start</OverTimeStartTime>
            <OverTimeStopTime>Stop</OverTimeStopTime>
            <OverTimeStartTime2>Start</OverTimeStartTime2>
            <OverTimeStopTime2>Stop</OverTimeStopTime2>
            <OverTimeHours>Over Time</OverTimeHours>
            <OtherStartTime>Start</OtherStartTime>
            <OtherStopTime>Stop</OtherStopTime>
            <OtherStartTime2>Start</OtherStartTime2>
            <OtherStopTime2>Stop</OtherStopTime2>
            <OtherHours>Other</OtherHours>
            <PerDiem>NO</PerDiem>
            <Notes>Notes</Notes>
        </TimeDetail>
    </Monday>
    <Tuesday>
        <TimeDetail>
            <StartTime>Start</StartTime>
            <StopTime>Stop</StopTime>
            <WorkOrderNumber>4812537</WorkOrderNumber>
            <RegularHoursStartTime>Start</RegularHoursStartTime>
            <RegularHoursStopTime>Stop</RegularHoursStopTime>
            <RegularHoursStartTime2>Start</RegularHoursStartTime2>
            <RegularHoursStopTime2>Stop</RegularHoursStopTime2>
            <RegularHours>12</RegularHours>
            <OverTimeStartTime>Start</OverTimeStartTime>
            <OverTimeStopTime>Stop</OverTimeStopTime>
            <OverTimeStartTime2>Start</OverTimeStartTime2>
            <OverTimeStopTime2>Stop</OverTimeStopTime2>
            <OverTimeHours>Over Time</OverTimeHours>
            <OtherStartTime>Start</OtherStartTime>
            <OtherStopTime>Stop</OtherStopTime>
            <OtherStartTime2>Start</OtherStartTime2>
            <OtherStopTime2>Stop</OtherStopTime2>
            <OtherHours>Other</OtherHours>
            <PerDiem>NO</PerDiem>
            <Notes>Notes</Notes>
        </TimeDetail>
    </Tuesday>
    <Wednesday>
        <TimeDetail>
            <StartTime>Start</StartTime>
            <StopTime>Stop</StopTime>
            <WorkOrderNumber>4812537</WorkOrderNumber>
            <RegularHoursStartTime>Start</RegularHoursStartTime>
            <RegularHoursStopTime>Stop</RegularHoursStopTime>
            <RegularHoursStartTime2>Start</RegularHoursStartTime2>
            <RegularHoursStopTime2>Stop</RegularHoursStopTime2>
            <RegularHours>11</RegularHours>
            <OverTimeStartTime>Start</OverTimeStartTime>
            <OverTimeStopTime>Stop</OverTimeStopTime>
            <OverTimeStartTime2>Start</OverTimeStartTime2>
            <OverTimeStopTime2>Stop</OverTimeStopTime2>
            <OverTimeHours>Over Time</OverTimeHours>
            <OtherStartTime>Start</OtherStartTime>
            <OtherStopTime>Stop</OtherStopTime>
            <OtherStartTime2>Start</OtherStartTime2>
            <OtherStopTime2>Stop</OtherStopTime2>
            <OtherHours>Other</OtherHours>
            <PerDiem>NO</PerDiem>
            <Notes>Notes</Notes>
        </TimeDetail>
    </Wednesday>
    <Thursday>
        <TimeDetail>
            <StartTime>Start</StartTime>
            <StopTime>Stop</StopTime>
            <WorkOrderNumber>4812537</WorkOrderNumber>
            <RegularHoursStartTime>Start</RegularHoursStartTime>
            <RegularHoursStopTime>Stop</RegularHoursStopTime>
            <RegularHoursStartTime2>Start</RegularHoursStartTime2>
            <RegularHoursStopTime2>Stop</RegularHoursStopTime2>
            <RegularHours>8</RegularHours>
            <OverTimeStartTime>Start</OverTimeStartTime>
            <OverTimeStopTime>Stop</OverTimeStopTime>
            <OverTimeStartTime2>Start</OverTimeStartTime2>
            <OverTimeStopTime2>Stop</OverTimeStopTime2>
            <OverTimeHours>3</OverTimeHours>
            <OtherStartTime>Start</OtherStartTime>
            <OtherStopTime>Stop</OtherStopTime>
            <OtherStartTime2>Start</OtherStartTime2>
            <OtherStopTime2>Stop</OtherStopTime2>
            <OtherHours>Other</OtherHours>
            <PerDiem>NO</PerDiem>
            <Notes>Notes</Notes>
        </TimeDetail>
    </Thursday>
    <Friday>
        <TimeDetail>
            <StartTime>Start</StartTime>
            <StopTime>Stop</StopTime>
            <WorkOrderNumber>4812537</WorkOrderNumber>
            <RegularHoursStartTime>Start</RegularHoursStartTime>
            <RegularHoursStopTime>Stop</RegularHoursStopTime>
            <RegularHoursStartTime2>Start</RegularHoursStartTime2>
            <RegularHoursStopTime2>Stop</RegularHoursStopTime2>
            <RegularHours>0</RegularHours>
            <OverTimeStartTime>Start</OverTimeStartTime>
            <OverTimeStopTime>Stop</OverTimeStopTime>
            <OverTimeStartTime2>Start</OverTimeStartTime2>
            <OverTimeStopTime2>Stop</OverTimeStopTime2>
            <OverTimeHours>7</OverTimeHours>
            <OtherStartTime>Start</OtherStartTime>
            <OtherStopTime>Stop</OtherStopTime>
            <OtherStartTime2>Start</OtherStartTime2>
            <OtherStopTime2>Stop</OtherStopTime2>
            <OtherHours>Other</OtherHours>
            <PerDiem>NO</PerDiem>
            <Notes>Notes</Notes>
        </TimeDetail>
    </Friday>
    <Saturday />
    <Sunday />
</TeamMember>
<Equipment>
    <EquipmentWorkOrder>
        <EquipmentWorkOrderNumber>4812537</EquipmentWorkOrderNumber>
        <EquipmentDetail>
            <EquipmentMileage>Mileage</EquipmentMileage>
            <EquipmentHourMeter>Hour Meter</EquipmentHourMeter>
            <EquipmentType>Bucket truck</EquipmentType>
            <EquipmentNumber>8s96</EquipmentNumber>
            <MondayHours>0</MondayHours>
            <TuesdayHours>12</TuesdayHours>
            <WednesdayHours>11</WednesdayHours>
            <ThursdayHours>11</ThursdayHours>
            <FridayHours>7</FridayHours>
            <SaturdayHours>Saturday</SaturdayHours>
            <SundayHours>Sunday</SundayHours>
            <EquipmentNotes>Notes</EquipmentNotes>
        </EquipmentDetail>
        <EquipmentDetail>
            <EquipmentMileage>Mileage</EquipmentMileage>
            <EquipmentHourMeter>Hour Meter</EquipmentHourMeter>
            <EquipmentType>Line truck</EquipmentType>
            <EquipmentNumber>20x949</EquipmentNumber>
            <MondayHours>9</MondayHours>
            <TuesdayHours>12</TuesdayHours>
            <WednesdayHours>11</WednesdayHours>
            <ThursdayHours>11</ThursdayHours>
            <FridayHours>7</FridayHours>
            <SaturdayHours>Saturday</SaturdayHours>
            <SundayHours>Sunday</SundayHours>
            <EquipmentNotes>Notes</EquipmentNotes>
        </EquipmentDetail>
        <EquipmentDetail>
            <EquipmentMileage>Mileage</EquipmentMileage>
            <EquipmentHourMeter>Hour Meter</EquipmentHourMeter>
            <EquipmentType>Pickup truck</EquipmentType>
            <EquipmentNumber>38g356</EquipmentNumber>
            <MondayHours>9</MondayHours>
            <TuesdayHours>12</TuesdayHours>
            <WednesdayHours>11</WednesdayHours>
            <ThursdayHours>11</ThursdayHours>
            <FridayHours>7</FridayHours>
            <SaturdayHours>Saturday</SaturdayHours>
            <SundayHours>Sunday</SundayHours>
            <EquipmentNotes>Notes</EquipmentNotes>
        </EquipmentDetail>
        <EquipmentDetail>
            <EquipmentMileage>Mileage</EquipmentMileage>
            <EquipmentHourMeter>Hour Meter</EquipmentHourMeter>
            <EquipmentType>Air compressor</EquipmentType>
            <EquipmentNumber>1d158</EquipmentNumber>
            <MondayHours>9</MondayHours>
            <TuesdayHours>12</TuesdayHours>
            <WednesdayHours>11</WednesdayHours>
            <ThursdayHours>11</ThursdayHours>
            <FridayHours>7</FridayHours>
            <SaturdayHours>Saturday</SaturdayHours>
            <SundayHours>Sunday</SundayHours>
            <EquipmentNotes>Notes</EquipmentNotes>
        </EquipmentDetail>
    </EquipmentWorkOrder>
</Equipment>
</Timesheet>

助けてくれてありがとう。

4

1 に答える 1