我是一名图书管理员,试图通过将我们的记录从广泛使用的平台翻译成Excel来进行收集分析。在使用了数月的XSL样式表之前,我已经收到了一些帮助。
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:strip-space elements="*" />
<xsl:template match="/">
<record>
<xsl:for-each select="//catalog">
<itemline>
<callNumber>
<xsl:value-of select="call/callNumber" />
</callNumber>
<title>
<xsl:value-of select="marc/marcEntry[@label='Title']" />
</title>
<yearOfPublication>
<xsl:value-of select="yearOfPublication" />
</yearOfPublication>
<xsl:for-each select="call/item/totalCheckouts">
<xsl:copy-of select="." />
</xsl:for-each>
<dateLastUsed>
<xsl:value-of select="call/item/dateLastUsed" />
</dateLastUsed>
<location>
<xsl:value-of select="call/item/location" />
</location>
</itemline>
</xsl:for-each>
</record>
</xsl:template>
</xsl:stylesheet>
突然,此代码不再适用于系统生成的新报告。我希望它将记录中的所有信息返回到Excel中的一行,但现在它将每条信息放在一个新行上,从而无法操纵数据。
以下是旧记录的示例:
<catalog>
<flexibleKey>l55041415</flexibleKey>
<numberOfTitleHolds>0</numberOfTitleHolds>
<totalHolds>0</totalHolds>
<numberOfCallNumbers>1</numberOfCallNumbers>
<bibliographicLevel>FULL</bibliographicLevel>
<catalogFormat>MARC</catalogFormat>
<createdBy>TECH</createdBy>
<dateCreated>2009-11-09</dateCreated>
<dateCataloged>2009-01-29</dateCataloged>
<modifiedBy>TECH</modifiedBy>
<dateModified>2009-11-12</dateModified>
<catalogKey>129825</catalogKey>
<yearOfPublication>1953</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="1 ">Colonius, Lillian.</marcEntry>
<marcEntry tag="245" label="Title" ind="10">At the bakery / by Lillian Colonius and Glenn W. Schroeder.</marcEntry>
<marcEntry tag="260" label="Publication info" ind=" ">Los Angeles, CA : Melmont Pub., Inc., c1953.</marcEntry>
<marcEntry tag="300" label="Physical description" ind=" ">24 p. : ill. ; 24 cm.</marcEntry>
<marcEntry tag="650" label="Subject term" ind=" 1">Bread.</marcEntry>
</marc>
<call>
<callNumber>PZ 10.C694 ATG 1958</callNumber>
<library>UOG-RFK</library>
<item>
<numberOfCharges>0</numberOfCharges>
<numberOfBills>0</numberOfBills>
<numberOfCopyHolds>0</numberOfCopyHolds>
<totalCharges>0</totalCharges>
<inhouseCharges>1</inhouseCharges>
<totalCheckouts>0</totalCheckouts>
<totalRenewals>0</totalRenewals>
<intervalCheckouts>0</intervalCheckouts>
<intervalRenewals>0</intervalRenewals>
<intervalStartDate></intervalStartDate>
<recirculate>YES</recirculate>
<dateLastUsed>2017-02-17</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33296000201835</itemID>
<library>UOG-RFK</library>
<libraryDescription>University of Guam - RFK Memorial Library</libraryDescription>
<location>JUVENILE</location>
<homeLocation>JUVENILE</homeLocation>
<price currency="$">30.00</price>
<category1>JUVENILE</category1>
<type>JUVENILE</type>
<numberOfPieces>1</numberOfPieces>
<dateCreated>2009-11-09</dateCreated>
<isPermanent>true</isPermanent>
</item>
</call>
</catalog>
以下是新记录的示例:
<catalog>
<catalogKey>59433</catalogKey>
<yearOfPublication>1999</yearOfPublication>
<marc>
<marcEntry tag="100" label="Personal Author" ind="1 ">Rose, Ed (Edwin)</marcEntry>
<marcEntry tag="245" label="Title" ind="10">50 ways to teach your learner : activities and interventions for building high-performance teams / by Ed Rose with Steve Buckley.</marcEntry>
<marcEntry tag="260" label="Publication info" ind=" ">San Francisco, CA : Jossey-Bass, c1999.</marcEntry>
<marcEntry tag="300" label="Physical description" ind=" ">xvii, 264 p. : ill. ; 28 cm.</marcEntry>
<marcEntry tag="650" label="Subject term" ind=" 0">Teams in the workplace--Training of.</marcEntry>
<marcEntry tag="650" label="Subject term" ind=" 0">Experiential learning.</marcEntry>
<marcEntry tag="700" label="Added Entry-Personal Name" ind="10">Buckley, Steve, 1960-</marcEntry>
</marc>
<call>
<callNumber>HD 66 .R65 1999</callNumber>
<library>UOG-RFK</library>
<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>2003-12-17</dateLastUsed>
<isReserveItem>false</isReserveItem>
<copyNumber>1</copyNumber>
<itemID>33296001664171</itemID>
<library>UOG-RFK</library>
<libraryDescription>University of Guam - RFK Memorial Library</libraryDescription>
<location>MAIN</location>
<homeLocation>MAIN</homeLocation>
<price currency="$">42.00</price>
<category1>MAIN</category1>
<type>BOOK</type>
<numberOfPieces>1</numberOfPieces>
<dateCreated>2002-05-22</dateCreated>
<isPermanent>true</isPermanent>
</item>
</call>
</catalog>
我没有看到任何会导致这种变化的记录结构发生重大变化,也不知道XSLT是否足以让它开始麻烦。
答案 0 :(得分:0)
我无法复制问题。您显示的两个输入记录产生具有相同结构(在限制范围内)的输出,实际上任何输入必须:输出的外部结构在样式表中是硬编码的,输出中的唯一变化是数据值和数量totalCheckouts
元素。
两个输入记录的不同之处仅在于“新”记录省略了catalog
元素的前11个子元素。由于样式表中没有一个被复制到输出中,因此你完全可以推测这种差异不应该对样式表输出的任何变化负责。
如果Excel中的结果发生了变化,那么最可能的原因是导入过程以某种方式发生了变化;如果它是手工完成的,很容易想象有人找到将XML数据导入Excel的不同方法,这些方法有不同的结果。如果导入过程是自动化的,那么我会问所用的Excel副本是否已经改变:它是否已经升级,是否有人更改了配置选项,......?如果电子表格软件和从XSLT导入输出的方法都没有改变,那么您可能希望再次查看以确保您提供的样本实际上是您所采用的样本。你能用这些样本复制不同的行为吗?