2017-10-06 241 views
0

我是一名图书管理员,尝试通过将我们的记录从广泛使用的平台转换为Excel来执行收集分析。之前我已经获得了一些帮助,可以在几个月内使用XSL样式表。XSL样式表不再适用于Excel

<?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

您可以分享输出和期望输出的差异吗? –

+1

我不确定这个问题是否与XSLT有关。它生成的XML实际上是如何导入到Excel中的? –

回答

0

我无法复制该问题。您显示的两个输入记录产生的输出具有相同的结构(在限制内),实际上任何输入都必须:输出的外部结构在您的样式表中被硬编码,并且输出中的唯一变化将是数据值和totalCheckouts元素。

这两个输入记录的不同之处仅在于“新”的元素省略了catalog元素的前十一个子元素。由于没有这些样式表被复制到输出中,所以你完全正确地猜测这种区别不应该对样式表输出的任何变化负责。

如果Excel中的结果发生了变化,那么最可能的原因是导入过程发生了某种变化;如果是手动完成的,很容易想象有人会找到不同的方法将XML数据导入到Excel中,而这些数据会有不同的结果。如果导入过程是自动化的,那么我会问使用的Excel副本是否已经改变:它是否已经升级,是否有人更改过配置选项,...?如果电子表格软件和导入XSLT输出的方法都没有改变,那么您可能需要再次查看以确保您提供的样本实际上是您采用的样本。你能否使用这些样本复制不同的行为?