如何使用XSLT让每个办公室在单独的页面上打印?

时间:2018-11-05 18:05:45

标签: xml xslt

我有下面的xml和xslt。

xml文件中的所有数据都打印在一页上。

每个办公室都有相关人员和传真机。

我希望每个办公室(办公室一,办公室二和办公室三)及其相关人员一起传真到每个打印件的单独页面上。

在此先感谢您的帮助。

personnel_roster.xml

 EventTime  UserID  SubAddr 

2018-05-07 15:42:13.000 114 1  <- This row    
2018-05-07 15:42:16.000 114 1  <- Not this row    
2018-05-07 15:42:26.000 114 1  <- Not this row    
2018-05-07 15:42:35.000 114 2  <- This row    
2018-05-07 15:42:43.000 114 2  <- Not this row    
2018-05-07 15:42:54.000 114 1  <- This row    
2018-05-07 15:43:02.000 114 1  <- Not this row    
2018-05-07 15:43:11.000 114 2  <- This row    
2018-05-07 15:43:20.000 114 2  <- Not this row    
2018-05-07 15:43:35.000 114 1  <- This row    
2018-05-07 15:43:42.000 114 1  <- Not this row    
2018-05-07 15:43:51.000 114 2  <- This row    
2018-05-07 15:43:58.000 114 2  <- Not this row

personnel_roster.xslt

<?xml version = "1.0"?>
<?xml-stylesheet type = "text/xsl" href = "personnel_roster.xslt"?>
<rows appMode="{appmode}" dateGenerated="11/05/2018">
  <row OfficeID="32" OfficeOutputOrder="1" Office="O1" OfficeTitle="Office One" RoomFaxID="88" RoomFaxNumber="(555) 555-1212" RoomNumberID="120">
    <personnel>
      <person PersonnelID="360" Name="Employee Supervisor" PositionRoomNumberID="120" phone="(555) 637-5770" PAETitle="Dir, Head Office" PositionEmployeeTypeID="C" PositionOutputOrder="1" />
      <person PersonnelID="850" Name="Employee One" PositionRoomNumberID="120" phone="(555) 694-7191" PAETitle="Principal Deputy Director" PositionEmployeeTypeID="C" PositionOutputOrder="2" />
      <person PersonnelID="669" Name="Employee Two" PositionRoomNumberID="120" phone="(555) 554-0199" PAETitle="Senior Assistant" PositionEmployeeTypeID="M" PositionOutputOrder="11" />
      <person PersonnelID="417" Name="Employee Three" PositionRoomNumberID="125" phone="(555) 336-4242" PAETitle="Special Assistant" PositionEmployeeTypeID="C" PositionOutputOrder="21" />
      <person PersonnelID="470" Name="Employee Four" PositionRoomNumberID="125" phone="(555) 587-9046" PositionEmployeeTypeID="C" PositionOutputOrder="21" />
      <person PersonnelID="474" Name="Employee Five" PositionRoomNumberID="125" phone="(555) 2270-8654" PAETitle="Special Assistant to the Director" PositionEmployeeTypeID="C" PositionOutputOrder="22" />
    </personnel>
    <officeFaxes>
      <fax RoomNumberID="120" RoomFaxNumber="(555) 614-8413" OfficeID="32" />
    </officeFaxes>
  </row>
  <row OfficeID="82" OfficeOutputOrder="5" Office="O2" OfficeTitle="Office Two" RoomFaxID="94" RoomFaxNumber="(555) 555-1213" RoomNumberID="121">
    <personnel>
      <person PersonnelID="582" Name="Employee Supervisor" PositionRoomNumberID="121" phone="(555) 693-7828" PAETitle="Director (O2)" PositionEmployeeTypeID="C" PositionOutputOrder="4" />
      <person PersonnelID="398" Name="Employee One" PositionRoomNumberID="126" phone="(555) 372-4329" PAETitle="T  Specialist" PositionEmployeeTypeID="C" PositionOutputOrder="20" />
      <person PersonnelID="338" Name="Employee Two" PositionRoomNumberID="121" phone="(555) 693-7825" PAETitle="Operations Research Analyst" PositionEmployeeTypeID="C" PositionOutputOrder="20" />
      <person PersonnelID="368" Name="Employee Three" PositionRoomNumberID="121" phone="(555) 693-2086" PAETitle="Operations Research Analyst" PositionEmployeeTypeID="C" PositionOutputOrder="20" />
      <person PersonnelID="365" Name="Employee Four" PositionRoomNumberID="121" phone="(555) 697-0223" PAETitle="Operations Research Analyst" PositionEmployeeTypeID="C" PositionOutputOrder="20" />
      <person PersonnelID="375" Name="Employee Five" PositionRoomNumberID="121" phone="(555) 693-4141" PAETitle="Operations Research Analyst" PositionEmployeeTypeID="C" PositionOutputOrder="20" />
      <person PersonnelID="797" Name="Employee Six" PositionRoomNumberID="121" phone="(555) 614-9271" PAETitle="Operations Research Analyst" PositionEmployeeTypeID="C" PositionOutputOrder="20" />
      <person PersonnelID="356" Name="Employee Seven" PositionRoomNumberID="121" phone="(555) 697-0361" PAETitle="Operations Research Analyst" PositionEmployeeTypeID="C" PositionOutputOrder="20" />
      <person PersonnelID="404" Name="Employee Eight" PositionRoomNumberID="126" phone="(555) 372-4331" PAETitle="manager" PositionEmployeeTypeID="C" PositionOutputOrder="20" />
    </personnel>
    <officeFaxes>
      <fax RoomNumberID="121" RoomFaxNumber="(555) 372-4342" OfficeID="82" />
      <fax RoomNumberID="121" RoomFaxNumber="(555) 372-4370" OfficeID="82" />
      <fax RoomNumberID="126" RoomFaxNumber="(555) 614-8413" OfficeID="82" />
    </officeFaxes>
  </row>
  <row OfficeID="76" OfficeOutputOrder="9" Office="O3" OfficeTitle="Office Three"  RoomFaxID="95" RoomFaxNumber="(555) 555-1214" RoomNumberID="122">
    <personnel>
      <person PersonnelID="763" Name="Employee Supervisor" PositionRoomNumberID="122" phone="(555) 697-9189" PAETitle="Director (O3)" PositionEmployeeTypeID="C" PositionOutputOrder="4" />
      <person PersonnelID="471" Name="Employee One" PositionRoomNumberID="122" phone="(555) 695-7935" PAETitle="Management and Program Analyst" PositionEmployeeTypeID="C" PositionOutputOrder="20" />
      <person PersonnelID="439" Name="Employee Two" PositionRoomNumberID="122" phone="(555) 614-3951" PAETitle="administrative Program Specialist" PositionEmployeeTypeID="C" PositionOutputOrder="20" />
      <person PersonnelID="446" Name="Employee Three" PositionRoomNumberID="122" phone="(555) 256-0636" PAETitle="Security Specialist" PositionEmployeeTypeID="C" PositionOutputOrder="20" />
      <person PersonnelID="456" Name="Employee Four" PositionRoomNumberID="122" phone="(555) 256-0603" PAETitle="Management and Program Analyst" PositionEmployeeTypeID="C" PositionOutputOrder="20" />
      <person PersonnelID="436" Name="Employee Five" PositionRoomNumberID="122" phone="(555) 695-8225" PAETitle="Talent Management Specialist" PositionEmployeeTypeID="C" PositionOutputOrder="20" />
      <person PersonnelID="729" Name="Employee Six" PositionRoomNumberID="122" phone="(555) 693-3038" PAETitle="Administrative Program Specialist (Facilities)" PositionEmployeeTypeID="C" PositionOutputOrder="20" />
    </personnel>
    <officeFaxes>
      <fax RoomNumberID="122" RoomFaxNumber="(555) 256-1412" OfficeID="76" />
    </officeFaxes>
  </row>
</rows>

1 个答案:

答案 0 :(得分:0)

我找到了一个CSS解决方案,我在每个办公室末端的分隔符行中使用了以下内联样式。

<tr style="page-break-after: always;">