XSL嵌套For-Each

时间:2016-04-19 14:26:22

标签: xml xslt

我在其他地方看过这个帖子,所以我为交叉发帖道歉,但我无法在那里找到我需要的答案。我有一个XML文档,我正在尝试修改一个XSL,它将迭代每个项目,然后遍历特定的嵌套节点。如下所示,目录中有多个节点。我希望我的XSL为每个人提供适当的值。

这是XML:

<report>
<title>Template</title>
<dateCreated>2016-04-18T09:22:10</dateCreated>
<dateFormat>mm/dd/yyyy</dateFormat>
<catalog>
<catalogKey>25787</catalogKey>
<yearOfPublication>1935</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="10">Durant, Will, 1885-

</marcEntry>
<marcEntry tag="245" label="Title" ind="14">The story of 

civilization.</marcEntry>
</marc>
<call>
<callNumber>901 DUR V. 02</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>20</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2005-04-26</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407002498655</itemID>
<location>NONFICTION</location>
</item>
</call>
<call>
<callNumber>901 DUR V. 03</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>26</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2003-12-11</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407001393147</itemID>
<location>TRACKING</location>
</item>
</call>
<call>
<callNumber>901 DUR V. 05</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>6</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2009-05-15</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407001942588</itemID>
<location>NONFICTION</location>
</item>
</call>
<call>
<callNumber>901 DUR V. 06</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>5</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2007-04-01</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407001393089</itemID>
<location>NONFICTION</location>
</item>
</call>
<call>
<callNumber>901 DUR V. 07</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>7</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2009-10-22</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407001393261</itemID>
<location>NONFICTION</location>
</item>
</call>
<call>
<callNumber>901 DUR V. 08</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>9</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2007-04-01</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407002722609</itemID>
<location>NONFICTION</location>
</item>
</call>
<call>
<callNumber>901 DUR V. 10</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>3</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2004-07-28</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407001942521</itemID>
<location>NONFICTION</location>
</item>
</call>
<call>
<callNumber>901 DUR V. 11</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>8</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2005-10-15</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407001392743</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>49172</catalogKey>
<yearOfPublication>2002</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="1 ">Gaddis, John 

Lewis.</marcEntry>
<marcEntry tag="245" label="Title" ind="14">The landscape of history : how 

historians map the past / John Lewis Gaddis.</marcEntry>
</marc>
<call>
<callNumber>901 GAD</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>9</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2009-05-14</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407002542346</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>33197</catalogKey>
<yearOfPublication>1946</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="10">Toynbee, Arnold 

Joseph, 1889-1975.</marcEntry>
<marcEntry tag="245" label="Title" ind="12">A study of history / by Arnold 

J. Toynbee...Abridgement of volumes I-      by D. C. Somervell.</marcEntry>
</marc>
<call>
<callNumber>901 TOY V. 02</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>2</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>1</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>1</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2012-01-04</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407001463882</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>40301</catalogKey>
<yearOfPublication>1965</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="10">Bernal, John Desmond, 

1901-</marcEntry>
<marcEntry tag="245" label="Title" ind="10">Science in history [by] J.D. 

Bernal.</marcEntry>
</marc>
<call>
<callNumber>901.9 BER</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>13</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2010-02-21</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407000449676</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>41847</catalogKey>
<yearOfPublication>1972</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="10">Laver, James, 1899-

</marcEntry>
<marcEntry tag="245" label="Title" ind="14">The age of illusion: manners 

and morals 1750-1848.</marcEntry>
</marc>
<call>
<callNumber>901.933 LAV</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>11</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2007-09-14</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407000450450</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>90504</catalogKey>
<yearOfPublication>2000</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="1 ">Aron, Paul, 1956-

</marcEntry>
<marcEntry tag="245" label="Title" ind="10">Unsolved mysteries of history : 

and eye-opening investigation into the most baffling events of all time / 

Paul Aron.</marcEntry>
</marc>
<call>
<callNumber>902 ARO</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>31</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>1</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>1</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2012-05-16</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407002294096</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>70904</catalogKey>
<yearOfPublication>1999</yearOfPublication>
<marc>
<marcEntry tag="245" label="Title" ind="00">Danger! : true stories of 

trouble and survival / collected and edited by James O'Reilly, Larry 

Habegger, and Sean O'Reilly.</marcEntry>
</marc>
<call>
<callNumber>904 DAN</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>17</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>1</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>1</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2010-12-16</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407002017182</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>3523</catalogKey>
<yearOfPublication>1965</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="10">Brinton, Crane, 1898

-1968.</marcEntry>
<marcEntry tag="245" label="Title" ind="14">The anatomy of revolution [by] 

Crane Brinton.</marcEntry>
</marc>
<call>
<callNumber>904.7 BRI</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>9</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>1</totalCheckouts>
<totalRenewals>1</totalRenewals>
<intervalCheckouts>1</intervalCheckouts>
<intervalRenewals>1</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2011-06-14</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407000111581</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>94781</catalogKey>
<yearOfPublication>1999</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="1 ">Parenti, Michael, 

1933-</marcEntry>
<marcEntry tag="245" label="Title" ind="10">History as mystery / by Michael 

Parenti.</marcEntry>
</marc>
<call>
<callNumber>907.2 PAR</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>27</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2011-07-01</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407002189304</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>17535</catalogKey>
<yearOfPublication>1996</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="1 ">Almond, 

Mark.</marcEntry>
<marcEntry tag="245" label="Title" ind="10">Revolution : 500 years of 

struggle for change / Mark Almond.</marcEntry>
</marc>
<call>
<callNumber>909 ALM</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>25</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>2</totalCheckouts>
<totalRenewals>1</totalRenewals>
<intervalCheckouts>2</intervalCheckouts>
<intervalRenewals>1</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2012-04-09</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407001885282</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>35512</catalogKey>
<yearOfPublication>1994</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="1 ">Boorstin, Daniel J. 

(Daniel Joseph), 1914-</marcEntry>
<marcEntry tag="245" label="Title" ind="10">Cleopatra's nose : essays on 

the unexpected / by Daniel J. Boorstin ; edited by Ruth F. 

Boorstin.</marcEntry>
</marc>
<call>
<callNumber>909 BOO</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>18</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2010-04-01</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407001625555</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>58912</catalogKey>
<yearOfPublication>1994</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="1 ">Braudel, 

Fernand.</marcEntry>
<marcEntry tag="245" label="Title" ind="12">A history of civilizations / 

Fernand Braudel ; translated by Richard Mayne.</marcEntry>
</marc>
<call>
<callNumber>909 BRA</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>42</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>2</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>2</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2012-05-11</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407001101060</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>32441</catalogKey>
<yearOfPublication>2001</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="1 ">Durant, Will, 1885-

</marcEntry>
<marcEntry tag="245" label="Title" ind="10">Heroes of history : a brief 

history of civilization from ancient times to the dawn of the modern age / 

Will Durant.</marcEntry>
</marc>
<call>
<callNumber>909 DUR</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>35</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>2</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>2</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2012-02-11</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407002427472</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>49356</catalogKey>
<yearOfPublication>2001</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="1 ">Evans, Colin, 1948-

</marcEntry>
<marcEntry tag="245" label="Title" ind="10">Great feuds in history : ten of 

the liveliest disputes ever / Colin Evans.</marcEntry>
</marc>
<call>
<callNumber>909 EVA</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>43</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2011-03-26</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407002381778</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>13409</catalogKey>
<yearOfPublication>1977</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="10">Greer, Thomas 

H.</marcEntry>
<marcEntry tag="245" label="Title" ind="12">A brief history of Western man 

/ Thomas H. Greer.</marcEntry>
</marc>
<call>
<callNumber>909 GRE</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>15</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>2</totalCheckouts>
<totalRenewals>1</totalRenewals>
<intervalCheckouts>2</intervalCheckouts>
<intervalRenewals>1</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2012-03-13</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407000651743</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>62035</catalogKey>
<yearOfPublication>1992</yearOfPublication>
<marc>
<marcEntry tag="245" label="Title" ind="02">A History of civilization : 

prehistory to the present / Robin W. Winks ... [et al.].</marcEntry>
</marc>
<call>
<callNumber>909 HIS</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>50</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2010-02-08</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407001370392</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>93890</catalogKey>
<yearOfPublication>1987</yearOfPublication>
<marc>
<marcEntry tag="245" label="Title" ind="12">A history of private life / 

Philippe Aries and Georges Duby, general editors.</marcEntry>
</marc>
<call>
<callNumber>909 HIS V. 03</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>7</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>1</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>1</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2012-01-07</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407002563847</itemID>
<location>NONFICTION</location>
</item>
</call>
<call>
<callNumber>909 HIS V. 04</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>8</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>1</totalCheckouts>
<totalRenewals>1</totalRenewals>
<intervalCheckouts>1</intervalCheckouts>
<intervalRenewals>1</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2012-03-18</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407002563904</itemID>
<location>NONFICTION</location>
</item>
</call>
<call>
<callNumber>909 HIS V. 05</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>2</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2008-02-02</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407002564381</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>
<catalog>
<catalogKey>100062</catalogKey>
<yearOfPublication>1998</yearOfPublication>
<marc>
<marcEntry tag="245" label="Title" ind="04">The Life millennium : the 100 

most important events &amp; people of the past 1,000 years / [editor, 

Robert Friedman].</marcEntry>
</marc>
<call>
<callNumber>909 LIF</callNumber>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>22</totalCharges>
<inhouseCharges>0</inhouseCharges>
<totalCheckouts>1</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>1</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2012-02-08</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33407002620340</itemID>
<location>NONFICTION</location>
</item>
</call>
</catalog>

</report>

我的XSL:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
  <body>
  <h2>Weeding Report</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
    <th style="text-align:left">Title1</th>
    <th style="text-align:left">Author</th>
    <th style="text-align:left">Pub Year</th>
        <th style="text-align:left">CallNumber</th>


    <th style="text-align:left">Charges</th>
    <th style="text-align:left">Last Check Out</th>
    <th style="text-align:left">Barcode</th>
    <th style="text-align:left">Location</th>
      </tr>
      <xsl:for-each select="report/catalog">
    <td><xsl:value-of select="marc/marcEntry[@label='Title']"/></td>
    <td><xsl:value-of select="marc/marcEntry[@label='Personal 

Author']"/></td>


    <td><xsl:value-of select="yearOfPublication"/></td>
      <tr>
    <xsl:for-each select="call">
        <td><xsl:value-of select="callNumber"/></td>


    <td><xsl:value-of select="item/totalCharges"/></td>
    <td><xsl:value-of select="item/dateLastUsed"/></td>
    <td><xsl:value-of select="item/itemID"/></td>
    <td><xsl:value-of select="item/location"/></td>

      </tr>
</xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

1 个答案:

答案 0 :(得分:1)

我猜(!)你想做的事情如下:

XSLT 1.0

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/catalog">
    <html>
        <body>
            <h2>Weeding Report</h2>
            <table border="1">
                <!-- header -->
                <tr bgcolor="#9acd32">
                    <th style="text-align:left">Title1</th>
                    <th style="text-align:left">Author</th>
                    <th style="text-align:left">Pub Year</th>

                    <th style="text-align:left">CallNumber</th>
                    <th style="text-align:left">Charges</th>
                    <th style="text-align:left">Last Check Out</th>
                    <th style="text-align:left">Barcode</th>
                    <th style="text-align:left">Location</th>
                </tr>

                <xsl:variable name="common">
                    <td><xsl:value-of select="marc/marcEntry[@label='Title']"/></td>
                    <td><xsl:value-of select="marc/marcEntry[@label='Personal Author']"/></td>
                    <td><xsl:value-of select="yearOfPublication"/></td>
                </xsl:variable>

                <xsl:for-each select="call">
                    <tr>
                        <xsl:copy-of select="$common"/>
                        <td><xsl:value-of select="callNumber"/></td>
                        <td><xsl:value-of select="item/totalCharges"/></td>
                        <td><xsl:value-of select="item/dateLastUsed"/></td>
                        <td><xsl:value-of select="item/itemID"/></td>
                        <td><xsl:value-of select="item/location"/></td>

                    </tr>
                </xsl:for-each>
            </table>
        </body>
    </html>
</xsl:template>

</xsl:stylesheet>

应用于您的示例输入,这将产生:

enter image description here

我不确定为什么你需要为每一行重复前三个单元格。

编辑:

要符合您编辑的格式,请尝试:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/report">
    <html>
        <body>
            <h2>Weeding Report</h2>
            <table border="1">
                <tr bgcolor="#9acd32">
                    <th style="text-align:left">Title1</th>
                    <th style="text-align:left">Author</th>
                    <th style="text-align:left">Pub Year</th>
                    <th style="text-align:left">CallNumber</th>
                    <th style="text-align:left">Charges</th>
                    <th style="text-align:left">Last Check Out</th>
                    <th style="text-align:left">Barcode</th>
                    <th style="text-align:left">Location</th>
                </tr>
                <xsl:for-each select="catalog">
                    <xsl:variable name="common">
                        <td><xsl:value-of select="marc/marcEntry[@label='Title']"/></td>
                        <td><xsl:value-of select="marc/marcEntry[@label='Personal Author']"/></td>
                        <td><xsl:value-of select="yearOfPublication"/></td>
                    </xsl:variable>
                    <xsl:for-each select="call">
                        <tr>
                            <xsl:copy-of select="$common"/>
                            <td><xsl:value-of select="callNumber"/></td>
                            <td><xsl:value-of select="item/totalCharges"/></td>
                            <td><xsl:value-of select="item/dateLastUsed"/></td>
                            <td><xsl:value-of select="item/itemID"/></td>
                            <td><xsl:value-of select="item/location"/></td>
                        </tr>
                    </xsl:for-each>
                </xsl:for-each>
            </table>
        </body>
    </html>
</xsl:template>

</xsl:stylesheet>