home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / ProPlus.WW / ProPsWW2.cab / YEAR.XSL < prev    next >
Extensible Markup Language  |  2006-07-16  |  36KB  |  1,003 lines

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2.  
  3.  
  4. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  5.     xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography">
  6.     <xsl:output method="xml" encoding="us-ascii"/>
  7.  
  8.  
  9.  
  10.     <xsl:variable name="const_SepNames">
  11.         <xsl:text>; </xsl:text>    
  12.     </xsl:variable>
  13.  
  14.     <xsl:variable name="const_SepLastFirst">
  15.         <xsl:text>, </xsl:text>    
  16.     </xsl:variable>
  17.  
  18.     <xsl:variable name="const_Space">
  19.         <xsl:text> </xsl:text>    
  20.     </xsl:variable>
  21.  
  22.     <xsl:variable name="const_BracketOpen">
  23.         <xsl:text>(</xsl:text>    
  24.     </xsl:variable>
  25.  
  26.     <xsl:variable name="const_BracketClose">
  27.         <xsl:text>)</xsl:text>    
  28.     </xsl:variable>
  29.  
  30.  
  31.  
  32.  
  33.     <xsl:template match="/">
  34.         <xsl:choose>
  35.             <xsl:when test="b:OfficeSortKey">
  36.                 <Key><xsl:text>Year</xsl:text></Key>
  37.             </xsl:when>
  38.  
  39.             <xsl:when test="b:Sources">
  40.                 <xsl:variable name="ListPopulatedWithMain">
  41.                     <xsl:call-template name="populateMain">
  42.                         <xsl:with-param name="Type">b:Sources</xsl:with-param>
  43.                     </xsl:call-template>
  44.                 </xsl:variable>
  45.                 
  46.                 <xsl:variable name="sList">
  47.                     <xsl:call-template name="sortedList">
  48.                         <xsl:with-param name="sourceRoot">
  49.                             <xsl:copy-of select="$ListPopulatedWithMain"/>
  50.                         </xsl:with-param>
  51.                         
  52.                     </xsl:call-template>
  53.                 </xsl:variable>
  54.  
  55.                 
  56.                 
  57.                 <Sources xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography">
  58.                 <xsl:for-each select="msxsl:node-set($sList)/b:Sources/b:Source">
  59.                     <Source>
  60.                         <xsl:copy-of select="b:Tag"/>
  61.                         <Display>
  62.  
  63.                             <xsl:variable name="display">
  64.  
  65.                                 <xsl:variable name="allAuthors">
  66.                                     <xsl:if test="string-length(b:Author/b:Main/b:Corporate)=0">
  67.                                         <xsl:for-each select="b:Author/b:Main">
  68.                                           <xsl:call-template name="formatPersonsAuthor"/>
  69.                                         </xsl:for-each>
  70.                                     </xsl:if>
  71.                                     <xsl:if test="string-length(b:Author/b:Main/b:Corporate)>0">
  72.                                           <xsl:value-of select="b:Author/b:Main/b:Corporate"/>
  73.                                     </xsl:if>                                        
  74.                                 </xsl:variable>
  75.  
  76.                                 <xsl:value-of select="b:Year"/>
  77.  
  78.                                 <xsl:if test="string-length($allAuthors) > 0">
  79.                                     <xsl:if test="string-length(normalize-space(b:Year)) > 0">
  80.                                         <xsl:value-of select="$const_Space"/>
  81.                                     </xsl:if>
  82.                                     <xsl:value-of select="$allAuthors"/>
  83.                                 </xsl:if>
  84.  
  85.                                 <xsl:if test="string-length(b:Title) > 0">
  86.                                     <xsl:if test="string-length(normalize-space($allAuthors)) > 0 or string-length(normalize-space(b:Year)) > 0">
  87.                                         <xsl:value-of select="$const_SepNames"/>
  88.                                     </xsl:if>
  89.                                     <xsl:value-of select="b:Title"/>
  90.                                 </xsl:if>
  91.                             </xsl:variable>
  92.                             
  93.                             <xsl:choose>
  94.                                 <xsl:when test="string-length(normalize-space($display))>0">
  95.                                     <xsl:value-of select="$display"/>
  96.                                 </xsl:when>
  97.                                 <xsl:otherwise>
  98.                                     <xsl:value-of select="b:Tag"/>
  99.                                 </xsl:otherwise>
  100.                             </xsl:choose>
  101.                         </Display>
  102.                         <SimpleSearch>
  103.                             <xsl:call-template name="simplesearchSource"/>
  104.                         </SimpleSearch>
  105.                     </Source>
  106.                 </xsl:for-each>
  107.                 </Sources>
  108.             </xsl:when>
  109.         </xsl:choose>
  110.     </xsl:template>
  111.  
  112.     
  113.     <xsl:template name="sortedList">
  114.         <xsl:param name="sourceRoot"/>
  115.         
  116.         <xsl:apply-templates select="msxsl:node-set($sourceRoot)/*">
  117.             <xsl:sort select="b:Year"/>
  118.             <xsl:sort select="b:Title"/>
  119.             
  120.             <xsl:sort select="b:Author/b:Main/b:NameList/b:Person[1]/b:Last" />
  121.             
  122.             <xsl:sort select="b:Author/b:Main/b:NameList/b:Person[1]/b:First" />
  123.             
  124.             <xsl:sort select="b:Author/b:Main/b:NameList/b:Person[1]/b:Middle"/>
  125.             
  126.         </xsl:apply-templates>
  127.         
  128.     </xsl:template>
  129.  
  130.  
  131.     <xsl:template match="*">
  132.         <xsl:element name="{name()}" namespace="{namespace-uri()}">
  133.             <xsl:for-each select="@*">
  134.                 <xsl:attribute name="{name()}" namespace="{namespace-uri()}">
  135.                     <xsl:value-of select="." />
  136.                 </xsl:attribute>
  137.             </xsl:for-each>
  138.             <xsl:apply-templates>        
  139.                 <xsl:sort select="b:Year" />
  140.                 <xsl:sort select="b:Title" />
  141.                 <xsl:sort select="b:Author/b:Main/b:NameList/b:Person[1]/b:Last" />
  142.                 <xsl:sort select="b:Author/b:Main/b:NameList/b:Person[1]/b:First" />
  143.             </xsl:apply-templates>
  144.         </xsl:element>
  145.     </xsl:template>
  146.  
  147.     <xsl:template match="text()">
  148.         <xsl:value-of select="." />
  149.     </xsl:template>
  150.     
  151.     <xsl:template name="populateMain">
  152.         <xsl:param name="Type"/>
  153.         
  154.         <xsl:element name="{$Type}">
  155.             
  156.             <xsl:for-each select="/*[$Type]/b:Source">
  157.                 
  158.                 <xsl:variable name="MostImportantAuthorLocalName">
  159.                     
  160.                     <xsl:call-template name="MainContributors"/>
  161.                 </xsl:variable>
  162.                 <xsl:element name="{'b:Source'}">
  163.           
  164.           <b:Title>
  165.             
  166.             <xsl:if test="string-length(b:Title)>0">
  167.               <xsl:value-of select="b:Title"/>
  168.             </xsl:if>
  169.             
  170.             <xsl:if test="string-length(b:Title)=0">
  171.               <xsl:choose>
  172.                 <xsl:when test="b:SourceType='Book' or
  173.                                 b:SourceType='JournalArticle' or
  174.                                 b:SourceType='ConferenceProceedings' or
  175.                                 b:SourceType='Report' or
  176.                                 b:SourceType='Performance' or
  177.                                 b:SourceType='Film' or
  178.                                 b:SourceType='Patent' or
  179.                                 b:SourceType='Case'">
  180.  
  181.                   <xsl:value-of select="b:ShortTitle"/>
  182.                 </xsl:when>
  183.  
  184.                 <xsl:when test="b:SourceType='BookSection'">
  185.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  186.                   <xsl:variable name="bookTitle" select="b:BookTitle"/>
  187.  
  188.                   <xsl:choose>
  189.                     <xsl:when test="string-length($shortTitle)>0">
  190.                       <xsl:value-of select="$shortTitle"/>
  191.                     </xsl:when>
  192.                     <xsl:when test="string-length($bookTitle)>0">
  193.                       <xsl:value-of select="$bookTitle"/>
  194.                     </xsl:when>
  195.                   </xsl:choose>
  196.  
  197.                 </xsl:when>
  198.  
  199.                 <xsl:when test="b:SourceType='ArticleInAPeriodical'">
  200.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  201.                   <xsl:variable name="periodicalTitle" select="b:PeriodicalTitle"/>
  202.  
  203.                   <xsl:choose>
  204.                     <xsl:when test="string-length($shortTitle)>0">
  205.                       <xsl:value-of select="$shortTitle"/>
  206.                     </xsl:when>
  207.                     <xsl:when test="string-length($periodicalTitle)>0">
  208.                       <xsl:value-of select="$periodicalTitle"/>
  209.                     </xsl:when>
  210.                   </xsl:choose>
  211.                 </xsl:when>
  212.  
  213.                 <xsl:when test="b:SourceType='InternetSite' or
  214.                                 b:SourceType='DocumentFromInternetSite'">
  215.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  216.                   <xsl:variable name="internetSiteTitle" select="b:InternetSiteTitle"/>
  217.  
  218.                   <xsl:choose>
  219.                     <xsl:when test="string-length($shortTitle)>0">
  220.                       <xsl:value-of select="$shortTitle"/>
  221.                     </xsl:when>
  222.                     <xsl:when test="string-length($internetSiteTitle)>0">
  223.                       <xsl:value-of select="$internetSiteTitle"/>
  224.                     </xsl:when>
  225.                   </xsl:choose>
  226.                 </xsl:when>
  227.  
  228.                 <xsl:when test="b:SourceType='ElectronicSource' or
  229.                                 b:SourceType='Art' or
  230.                                 b:SourceType='Misc'">
  231.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  232.                   <xsl:variable name="publicationTitle" select="b:PublicationTitle"/>
  233.  
  234.                   <xsl:choose>
  235.                     <xsl:when test="string-length($shortTitle)>0">
  236.                       <xsl:value-of select="$shortTitle"/>
  237.                     </xsl:when>
  238.                     <xsl:when test="string-length($publicationTitle)>0">
  239.                       <xsl:value-of select="$publicationTitle"/>
  240.                     </xsl:when>
  241.                   </xsl:choose>
  242.                 </xsl:when>
  243.  
  244.                 <xsl:when test="b:SourceType='SoundRecording'">
  245.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  246.                   <xsl:variable name="albumTitle" select="b:AlbumTitle"/>
  247.  
  248.                   <xsl:choose>
  249.                     <xsl:when test="string-length($shortTitle)>0">
  250.                       <xsl:value-of select="$shortTitle"/>
  251.                     </xsl:when>
  252.                     <xsl:when test="string-length($albumTitle)>0">
  253.                       <xsl:value-of select="$albumTitle"/>
  254.                     </xsl:when>
  255.                   </xsl:choose>
  256.                 </xsl:when>
  257.  
  258.                 <xsl:when test="b:SourceType='Interview'">
  259.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  260.                   
  261.                   <xsl:variable name="broadcastTitle" select="b:BroadcastTitle"/>
  262.                   
  263.  
  264.                   <xsl:choose>
  265.                     <xsl:when test="string-length($shortTitle)>0">
  266.                       <xsl:value-of select="$shortTitle"/>
  267.                     </xsl:when>
  268.                     
  269.                     <xsl:when test="string-length($broadcastTitle)>0">
  270.                       <xsl:value-of select="$broadcastTitle"/>
  271.                     </xsl:when>
  272.                     
  273.                   </xsl:choose>
  274.                 </xsl:when>
  275.  
  276.               </xsl:choose>
  277.             </xsl:if>
  278.           </b:Title>
  279.           
  280.                     <b:Author>
  281.                         
  282.                         <b:Main>
  283.                             <xsl:if test="string-length(./b:Author/*[local-name()=$MostImportantAuthorLocalName]/b:Corporate)=0">
  284.                                 <b:NameList>
  285.                                     <xsl:for-each select="./b:Author/*[local-name()=$MostImportantAuthorLocalName]/b:NameList/b:Person">
  286.                                         <b:Person>
  287.                                             
  288.                                             <b:Last>
  289.                                                 <xsl:value-of select="./b:Last"/>
  290.                                             </b:Last>
  291.                                             <b:First>
  292.                                                 <xsl:value-of select="./b:First"/>
  293.                                             </b:First>
  294.                                             <b:Middle>
  295.                                                 <xsl:value-of select="./b:Middle"/>
  296.                                             </b:Middle>
  297.                                         </b:Person>
  298.                                     </xsl:for-each>
  299.                                 </b:NameList>
  300.                             </xsl:if>
  301.                             <xsl:if test="string-length(./b:Author/*[local-name()=$MostImportantAuthorLocalName]/b:Corporate)>0">
  302.                                 <b:Corporate>
  303.                                   <xsl:value-of select="./b:Author/*[local-name()=$MostImportantAuthorLocalName]/b:Corporate"/>
  304.                                 </b:Corporate>
  305.                             </xsl:if>
  306.                         </b:Main>
  307.                         <xsl:for-each select="./b:Author/*">
  308.                             
  309.                             <xsl:if test="name()!='b:Main'">
  310.                                 <xsl:element name="{name()}" namespace="{namespace-uri()}">
  311.                                     <xsl:call-template name="copyNameNodes"/>
  312.                                     
  313.                                 </xsl:element>
  314.                             </xsl:if>
  315.                         </xsl:for-each>
  316.                     </b:Author>
  317.                     <xsl:for-each select="*">
  318.                         
  319.             <xsl:if test="name()!='b:Author' and name()!='b:Title'">
  320.               <xsl:element name="{name()}" namespace="{namespace-uri()}">
  321.                                 <xsl:call-template name="copyNodes"/>
  322.                                 
  323.                             </xsl:element>
  324.                         </xsl:if>
  325.                     </xsl:for-each>
  326.                 </xsl:element>
  327.             </xsl:for-each>
  328.             <xsl:for-each select="/*[$Type]/*">
  329.                 
  330.                 <xsl:if test="local-name()!='Source'">
  331.                     <xsl:call-template name="copyTrees"/>
  332.                 </xsl:if>
  333.             </xsl:for-each>
  334.         </xsl:element>
  335.     </xsl:template>
  336.     
  337.     
  338.     
  339.     <xsl:template name="MainContributors">
  340.         <xsl:param name="SourceRoot"/>
  341.         <xsl:choose>
  342.             <xsl:when test="./b:SourceType='Book'">
  343.                 <xsl:choose>
  344.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  345.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  346.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  347.                 </xsl:choose>
  348.             </xsl:when>
  349.  
  350.             <xsl:when test="./b:SourceType='BookSection'">
  351.                 <xsl:choose>
  352.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  353.                     <xsl:when test="string-length(./b:Author/b:BookAuthor)>0">BookAuthor</xsl:when>
  354.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  355.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  356.                 </xsl:choose>
  357.             </xsl:when>
  358.  
  359.             <xsl:when test="./b:SourceType='JournalArticle'">
  360.                 <xsl:choose>
  361.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  362.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  363.                 </xsl:choose>
  364.             </xsl:when>
  365.  
  366.             <xsl:when test="./b:SourceType='ArticleInAPeriodical'">
  367.                 <xsl:choose>
  368.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  369.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  370.                 </xsl:choose>
  371.             </xsl:when>
  372.  
  373.             <xsl:when test="./b:SourceType='ConferenceProceedings'">
  374.                 <xsl:choose>
  375.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  376.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  377.                 </xsl:choose>
  378.             </xsl:when>
  379.  
  380.             <xsl:when test="./b:SourceType='Report'">
  381.                 <xsl:choose>
  382.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  383.                 </xsl:choose>
  384.             </xsl:when>
  385.  
  386.             <xsl:when test="./b:SourceType='SoundRecording'">
  387.                 <xsl:choose>
  388.                     <xsl:when test="string-length(./b:Author/b:Performer)>0">Performer</xsl:when>
  389.                     <xsl:when test="string-length(./b:Author/b:Artist)>0">Artist</xsl:when>
  390.                     <xsl:when test="string-length(./b:Author/b:Composer)>0">Composer</xsl:when>
  391.                     <xsl:when test="string-length(./b:Author/b:Conductor)>0">Conductor</xsl:when>
  392.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  393.                 </xsl:choose>
  394.             </xsl:when>
  395.  
  396.             <xsl:when test="./b:SourceType='Performance'">
  397.                 <xsl:choose>
  398.                     <xsl:when test="string-length(./b:Author/b:Writer)>0">Writer</xsl:when>
  399.                     <xsl:when test="string-length(./b:Author/b:Performer)>0">Performer</xsl:when>
  400.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  401.                     <xsl:when test="string-length(./b:Author/b:Director)>0">Director</xsl:when>
  402.                 </xsl:choose>
  403.             </xsl:when>
  404.  
  405.             <xsl:when test="./b:SourceType='Art'">
  406.                 <xsl:choose>
  407.                     <xsl:when test="string-length(./b:Author/b:Artist)>0">Artist</xsl:when>
  408.                 </xsl:choose>
  409.             </xsl:when>
  410.  
  411.             <xsl:when test="./b:SourceType='DocumentFromInternetSite'">
  412.                 <xsl:choose>
  413.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  414.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  415.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  416.                 </xsl:choose>
  417.             </xsl:when>
  418.  
  419.             <xsl:when test="./b:SourceType='InternetSite'">
  420.                 <xsl:choose>
  421.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  422.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  423.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  424.                 </xsl:choose>
  425.             </xsl:when>
  426.  
  427.             <xsl:when test="./b:SourceType='Film'">
  428.                 <xsl:choose>
  429.                     <xsl:when test="string-length(./b:Author/b:Writer)>0">Writer</xsl:when>
  430.                     <xsl:when test="string-length(./b:Author/b:Performer)>0">Performer</xsl:when>
  431.                     <xsl:when test="string-length(./b:Author/b:Director)>0">Director</xsl:when>
  432.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  433.                 </xsl:choose>
  434.             </xsl:when>
  435.  
  436.             <xsl:when test="./b:SourceType='Interview'">
  437.                 <xsl:choose>
  438.                     <xsl:when test="string-length(./b:Author/b:Interviewee)>0">Interviewee</xsl:when>
  439.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  440.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  441.                     <xsl:when test="string-length(./b:Author/b:Interviewer)>0">Interviewer</xsl:when>
  442.                     <xsl:when test="string-length(./b:Author/b:Compiler)>0">Compiler</xsl:when>
  443.                 </xsl:choose>
  444.             </xsl:when>
  445.  
  446.             <xsl:when test="./b:SourceType='Patent'">
  447.                 <xsl:choose>
  448.                     <xsl:when test="string-length(./b:Author/b:Inventor)>0">Inventor</xsl:when>
  449.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  450.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  451.                 </xsl:choose>
  452.             </xsl:when>
  453.  
  454.             <xsl:when test="./b:SourceType='ElectronicSource'">
  455.                 <xsl:choose>
  456.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  457.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  458.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  459.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  460.                 </xsl:choose>
  461.             </xsl:when>
  462.  
  463.             <xsl:when test="./b:SourceType='Case'">
  464.                 <xsl:choose>
  465.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  466.                     <xsl:when test="string-length(./b:Author/b:Counsel)>0">Counsel</xsl:when>
  467.                 </xsl:choose>
  468.             </xsl:when>
  469.  
  470.             <xsl:when test="./b:SourceType='Misc'">
  471.                 <xsl:choose>
  472.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  473.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  474.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  475.                     <xsl:when test="string-length(./b:Author/b:Compiler)>0">Compiler</xsl:when>
  476.                 </xsl:choose>
  477.             </xsl:when>
  478.         </xsl:choose>
  479.     </xsl:template>
  480.  
  481.     <xsl:template name="copyNameNodes">
  482.         <xsl:if test="string-length(b:Corporate)=0">
  483.             <b:NameList>
  484.                 <xsl:for-each select="b:NameList/b:Person">
  485.                     
  486.                     <b:Person>
  487.                         
  488.                         <xsl:if test="string-length(./b:Last)>0">
  489.                             
  490.                             <b:Last>
  491.                                 <xsl:value-of select="./b:Last"/>
  492.                             </b:Last>
  493.                         </xsl:if>
  494.                         <xsl:if test="string-length(./b:First)>0">
  495.                             <b:First>
  496.                                 <xsl:value-of select="./b:First"/>
  497.                             </b:First>
  498.                         </xsl:if>
  499.                         <xsl:if test="string-length(./b:Middle)">
  500.                             <b:Middle>
  501.                                 <xsl:value-of select="./b:Middle"/>
  502.                             </b:Middle>
  503.                         </xsl:if>
  504.                     </b:Person>
  505.                 </xsl:for-each>
  506.             </b:NameList>
  507.         </xsl:if>
  508.         <xsl:if test="string-length(b:Corporate)>0">
  509.             <b:Corporate>
  510.               <xsl:value-of select="b:Corporate"/>
  511.             </b:Corporate>
  512.         </xsl:if>
  513.     </xsl:template>
  514.  
  515.  
  516.     <xsl:template name="copyNodes">
  517.         <xsl:value-of select="."/>
  518.     </xsl:template>
  519.  
  520.  
  521.     <xsl:template name="copyTrees">
  522.         <xsl:copy-of select ='.'/>
  523.     </xsl:template>
  524.  
  525.     <xsl:template name="simplesearchField">
  526.         <xsl:choose>
  527.             <xsl:when test="local-name()='Guid'"/>
  528.             <xsl:when test="local-name()='RefOrder'"/>
  529.             <xsl:when test="local-name()='SourceType'"/>
  530.             <xsl:otherwise>
  531.                 <xsl:value-of select="." /><xsl:text> </xsl:text>
  532.             </xsl:otherwise>
  533.         </xsl:choose>
  534.  
  535.         <xsl:for-each select="*">
  536.                 <xsl:call-template name="simplesearchField"/>
  537.         </xsl:for-each>
  538.     </xsl:template>
  539.  
  540.     <xsl:template name="simplesearchSource">
  541.         <xsl:for-each select="*">
  542.             <xsl:call-template name="simplesearchField"/>
  543.         </xsl:for-each>
  544.     </xsl:template>
  545.  
  546.   <xsl:template name="formatIntervieweeLfmSku">
  547.     <xsl:for-each select="b:Author/b:Interviewee">
  548.       <xsl:call-template name="formatPersonsAuthor"/>
  549.     </xsl:for-each>
  550.   </xsl:template>
  551.  
  552.   <xsl:template name="formatInterviewerLfmSku">
  553.     <xsl:for-each select="b:Author/b:Interviewer">
  554.       <xsl:call-template name="formatPersonsAuthor"/>
  555.     </xsl:for-each>
  556.   </xsl:template>
  557.  
  558.   <xsl:template name="formatPersonsAuthor">
  559.     <xsl:if test="string-length(b:Corporate)=0">
  560.         <xsl:for-each select="b:NameList/b:Person">
  561.           <xsl:if test="6 >= position()">
  562.             <xsl:call-template name="formatMainAuthor"/>
  563.           </xsl:if>
  564.           <xsl:call-template name="formatPersonSeperatorMain"/>
  565.         </xsl:for-each>
  566.     </xsl:if>
  567.     <xsl:if test="string-length(b:Corporate)>0">
  568.       <xsl:value-of select="b:Corporate"/>
  569.     </xsl:if>
  570.   </xsl:template>
  571.  
  572.   <xsl:template name="formatMainAuthor">
  573.     <xsl:call-template name="formatNameCore">
  574.       <xsl:with-param name="FML">
  575.         <xsl:call-template name="templ_prop_Authors_FML"/>
  576.       </xsl:with-param>
  577.       <xsl:with-param name="FM">
  578.         <xsl:call-template name="templ_prop_Authors_FM"/>
  579.       </xsl:with-param>
  580.       <xsl:with-param name="ML">
  581.         <xsl:call-template name="templ_prop_Authors_ML"/>
  582.       </xsl:with-param>
  583.       <xsl:with-param name="FL">
  584.         <xsl:call-template name="templ_prop_Authors_FL"/>
  585.       </xsl:with-param>
  586.       <xsl:with-param name="upperLast">no</xsl:with-param>
  587.       <xsl:with-param name="withDot">yes</xsl:with-param>
  588.  
  589.     </xsl:call-template>
  590.   </xsl:template>
  591.  
  592.   <xsl:template name="formatPersonSeperatorMain">
  593.     <xsl:param name="isLast"/>
  594.  
  595.     <xsl:choose>
  596.       <xsl:when test="6 >= count(../b:Person) and position() = count(../b:Person) - 1">
  597.         <xsl:call-template name="templ_prop_AuthorsSeparator"/>
  598.         <xsl:if test="string-length($isLast)=0 or $isLast=true()">
  599.           <xsl:call-template name="templ_prop_Space"/>
  600.         </xsl:if>
  601.       </xsl:when>
  602.       <xsl:when test="6 > position() and position() != count(../b:Person)">
  603.         <xsl:call-template name="templ_prop_AuthorsSeparator"/>
  604.       </xsl:when>
  605.       <xsl:when test="count(../b:Person) > 6 and position() = count(../b:Person)">
  606.         <xsl:call-template name="templ_prop_AuthorsSeparator"/>
  607.         <xsl:call-template name="templ_str_AndOthersUnCap"/>
  608.       </xsl:when>
  609.       <xsl:when test="position()>6">
  610.       </xsl:when>
  611.     </xsl:choose>
  612.   </xsl:template>
  613.  
  614.   <xsl:template name="formatNameCore">
  615.     <xsl:param name="FML"/>
  616.     <xsl:param name="FM"/>
  617.     <xsl:param name="ML"/>
  618.     <xsl:param name="FL"/>
  619.     <xsl:param name="upperLast"/>
  620.     <xsl:param name="withDot"/>
  621.  
  622.     <xsl:variable name="first">
  623.       <xsl:call-template name="handleSpaces">
  624.         <xsl:with-param name="field" select="b:First"/>
  625.       </xsl:call-template>
  626.     </xsl:variable>
  627.  
  628.     <xsl:variable name="middle">
  629.       <xsl:call-template name="handleSpaces">
  630.         <xsl:with-param name="field" select="b:Middle"/>
  631.       </xsl:call-template>
  632.     </xsl:variable>
  633.  
  634.     <xsl:variable name="last">
  635.       <xsl:call-template name="handleSpaces">
  636.         <xsl:with-param name="field" select="b:Last"/>
  637.       </xsl:call-template>
  638.     </xsl:variable>
  639.  
  640.     <xsl:variable name="format">
  641.       <xsl:choose>
  642.         <xsl:when test="string-length($first) = 0 and string-length($middle) = 0 and string-length($last) = 0 ">
  643.         </xsl:when>
  644.         <xsl:when test="string-length($first) = 0 and string-length($middle) = 0 and string-length($last) != 0 ">
  645.           <xsl:text>%L</xsl:text>
  646.         </xsl:when>
  647.         <xsl:when test="string-length($first) = 0 and string-length($middle) != 0 and string-length($last) = 0 ">
  648.           <xsl:text>%M</xsl:text>
  649.         </xsl:when>
  650.         <xsl:when test="string-length($first) = 0 and string-length($middle) != 0 and string-length($last) != 0 ">
  651.           <xsl:value-of select="$ML"/>
  652.         </xsl:when>
  653.         <xsl:when test="string-length($first) != 0 and string-length($middle) = 0 and string-length($last) = 0 ">
  654.           <xsl:text>%F</xsl:text>
  655.         </xsl:when>
  656.         <xsl:when test="string-length($first) != 0 and string-length($middle) = 0 and string-length($last) != 0 ">
  657.           <xsl:value-of select="$FL"/>
  658.         </xsl:when>
  659.         <xsl:when test="string-length($first) != 0 and string-length($middle) != 0 and string-length($last) = 0 ">
  660.           <xsl:value-of select="$FM"/>
  661.         </xsl:when>
  662.         <xsl:when test="string-length($first) != 0 and string-length($middle) != 0 and string-length($last) != 0 ">
  663.           <xsl:value-of select="$FML"/>
  664.         </xsl:when>
  665.       </xsl:choose>
  666.     </xsl:variable>
  667.  
  668.     <xsl:call-template name="StringFormatName">
  669.       <xsl:with-param name="format" select="$format"/>
  670.       <xsl:with-param name="upperLast" select="$upperLast"/>
  671.       <xsl:with-param name="withDot" select="$withDot"/>
  672.     </xsl:call-template>
  673.  
  674.   </xsl:template>
  675.  
  676.   <xsl:template name="StringFormatName">
  677.     <xsl:param name="format" />
  678.     <xsl:param name="withDot" />
  679.     <xsl:param name="upperLast"/>
  680.  
  681.     <xsl:variable name="prop_EndChars">
  682.       <xsl:call-template name="templ_prop_EndChars"/>
  683.     </xsl:variable>
  684.  
  685.     <xsl:choose>
  686.       <xsl:when test="$format = ''"></xsl:when>
  687.       <xsl:when test="substring($format, 1, 2) = '%%'">
  688.         <xsl:text>%</xsl:text>
  689.         <xsl:call-template name="StringFormatName">
  690.           <xsl:with-param name="format" select="substring($format, 3)" />
  691.           <xsl:with-param name="withDot" select="$withDot" />
  692.           <xsl:with-param name="upperLast" select="$upperLast" />
  693.         </xsl:call-template>
  694.  
  695.         <xsl:if test="string-length($format)=2 and withDot = 'yes' and not(contains($prop_EndChars, '%'))">
  696.           <xsl:call-template name="templ_prop_Dot"/>
  697.         </xsl:if>
  698.       </xsl:when>
  699.       <xsl:when test="substring($format, 1, 1) = '%'">
  700.         <xsl:variable name="what" select="substring($format, 2, 1)" />
  701.  
  702.         <xsl:choose>
  703.           <xsl:when test="(what = 'l' or what = 'L') and upperLast = 'yes'">
  704.             <span style='text-transform: uppercase;'>
  705.               <xsl:call-template name="formatNameOneItem">
  706.                 <xsl:with-param name="format" select="$what"/>
  707.               </xsl:call-template>
  708.             </span>
  709.           </xsl:when>
  710.           <xsl:otherwise>
  711.             <xsl:call-template name="formatNameOneItem">
  712.               <xsl:with-param name="format" select="$what"/>
  713.             </xsl:call-template>
  714.           </xsl:otherwise>
  715.         </xsl:choose>
  716.         <xsl:call-template name="StringFormatName">
  717.           <xsl:with-param name="format" select="substring($format, 3)" />
  718.           <xsl:with-param name="withDot" select="$withDot" />
  719.           <xsl:with-param name="upperLast" select="$upperLast" />
  720.         </xsl:call-template>
  721.         <xsl:if test="string-length($format)=2 and withDot='yes'">
  722.           <xsl:variable name="temp2">
  723.             <xsl:call-template name="handleSpaces">
  724.               <xsl:with-param name="field">
  725.                 <xsl:call-template name="formatNameOneItem">
  726.                   <xsl:with-param name="format" select="$what"/>
  727.                 </xsl:call-template>
  728.               </xsl:with-param>
  729.             </xsl:call-template>
  730.           </xsl:variable>
  731.           <xsl:variable name="lastChar">
  732.             <xsl:value-of select="substring($temp2, string-length($temp2))"/>
  733.           </xsl:variable>
  734.           <xsl:if test="not(contains($prop_EndChars, $lastChar))">
  735.             <xsl:call-template name="templ_prop_Dot"/>
  736.           </xsl:if>
  737.         </xsl:if>
  738.       </xsl:when>
  739.       <xsl:otherwise>
  740.         <xsl:value-of select="substring($format, 1, 1)" />
  741.         <xsl:call-template name="StringFormatName">
  742.           <xsl:with-param name="format" select="substring($format, 2)" />
  743.           <xsl:with-param name="withDot" select="$withDot" />
  744.           <xsl:with-param name="upperLast" select="$upperLast" />
  745.         </xsl:call-template>
  746.         <xsl:if test="string-length($format)=1">
  747.           <xsl:if test="withDot = 'yes' and not(contains($prop_EndChars, $format))">
  748.             <xsl:call-template name="templ_prop_Dot"/>
  749.           </xsl:if>
  750.         </xsl:if>
  751.       </xsl:otherwise>
  752.     </xsl:choose>
  753.   </xsl:template>
  754.  
  755.   <xsl:template name="formatNameOneItem">
  756.     <xsl:param name="format"/>
  757.  
  758.     <xsl:choose>
  759.       <xsl:when test="$format = 'F'">
  760.         <xsl:value-of select="b:First"/>
  761.       </xsl:when>
  762.       <xsl:when test="$format = 'L'">
  763.         <xsl:value-of select="b:Last"/>
  764.       </xsl:when>
  765.       <xsl:when test="$format = 'M'">
  766.         <xsl:value-of select="b:Middle"/>
  767.       </xsl:when>
  768.       <xsl:when test="$format = 'f'">
  769.         <xsl:call-template name="formatNameInitial">
  770.           <xsl:with-param name="name" select="b:First"/>
  771.         </xsl:call-template>
  772.       </xsl:when>
  773.       <xsl:when test="$format = 'm'">
  774.         <xsl:call-template name="formatNameInitial">
  775.           <xsl:with-param name="name" select="b:Middle"/>
  776.         </xsl:call-template>
  777.       </xsl:when>
  778.       <xsl:when test="$format = 'l'">
  779.         <xsl:call-template name="formatNameInitial">
  780.           <xsl:with-param name="name" select="b:Last"/>
  781.         </xsl:call-template>
  782.       </xsl:when>
  783.     </xsl:choose>
  784.  
  785.   </xsl:template>
  786.  
  787.   <xsl:template name="formatNameInitial">
  788.     <xsl:param name="name"/>
  789.     <xsl:variable name="temp">
  790.       <xsl:call-template name="handleSpaces">
  791.         <xsl:with-param name="field" select="$name"/>
  792.       </xsl:call-template>
  793.     </xsl:variable>
  794.  
  795.     <xsl:variable name="prop_APA_Hyphens">
  796.       <xsl:call-template name="templ_prop_Hyphens"/>
  797.     </xsl:variable>
  798.  
  799.     <xsl:if test="string-length($temp)>0">
  800.  
  801.       <xsl:variable name="tempWithoutSpaces">
  802.         <xsl:value-of select="translate($temp, '  ', '')"/>
  803.         
  804.       </xsl:variable>
  805.  
  806.       <xsl:if test="not(contains($prop_APA_Hyphens, substring($tempWithoutSpaces, 1, 1)))">
  807.         <xsl:value-of select="substring($tempWithoutSpaces, 1, 1)"/>
  808.         <xsl:call-template name="templ_prop_DotInitial"/>
  809.       </xsl:if>
  810.  
  811.       <xsl:call-template name="handleHyphens">
  812.         <xsl:with-param name="name" select="$tempWithoutSpaces"/>
  813.       </xsl:call-template>
  814.     </xsl:if>
  815.   </xsl:template>
  816.  
  817.   <xsl:template name="handleHyphens">
  818.     <xsl:param name="name"/>
  819.  
  820.     <xsl:variable name="prop_APA_Hyphens">
  821.       <xsl:call-template name="templ_prop_Hyphens"/>
  822.     </xsl:variable>
  823.  
  824.     <xsl:if test="string-length($name)>=2">
  825.       <xsl:choose>
  826.         <xsl:when test="contains($prop_APA_Hyphens, substring($name, 1, 1))">
  827.           <xsl:value-of select="substring($name, 1, 2)"/>
  828.           <xsl:call-template name="templ_prop_DotInitial"/>
  829.  
  830.           <xsl:call-template name="handleHyphens">
  831.             <xsl:with-param name="name" select="substring($name, 3)"/>
  832.           </xsl:call-template>
  833.         </xsl:when>
  834.  
  835.         <xsl:otherwise>
  836.           <xsl:call-template name="handleHyphens">
  837.             <xsl:with-param name="name" select="substring($name, 2)"/>
  838.           </xsl:call-template>
  839.         </xsl:otherwise>
  840.       </xsl:choose>
  841.  
  842.     </xsl:if>
  843.  
  844.   </xsl:template>
  845.  
  846.   <xsl:template name="handleSpaces">
  847.     <xsl:param name="field"/>
  848.  
  849.     <xsl:variable name="prop_NormalizeSpace">
  850.       <xsl:call-template name="templ_prop_NormalizeSpace"/>
  851.     </xsl:variable>
  852.  
  853.     <xsl:choose>
  854.       <xsl:when test="$prop_NormalizeSpace='yes'">
  855.         <xsl:value-of select="normalize-space($field)"/>
  856.       </xsl:when>
  857.       <xsl:otherwise>
  858.         <xsl:value-of select="$field"/>
  859.       </xsl:otherwise>
  860.     </xsl:choose>
  861.   </xsl:template>
  862.  
  863.   <xsl:template name="localLCID">
  864.     <xsl:value-of select="/*/b:Locals/b:DefaultLCID"/>
  865.   </xsl:template>
  866.  
  867.   
  868.   <xsl:template name="templ_prop_NormalizeSpace" >
  869.     <xsl:param name="LCID" />
  870.     <xsl:variable name="_LCID">
  871.       <xsl:call-template name="localLCID">
  872.         <xsl:with-param name="LCID" select="$LCID"/>
  873.       </xsl:call-template>
  874.     </xsl:variable>
  875.     <xsl:text>no</xsl:text>
  876.     
  877.   </xsl:template>
  878.  
  879.   
  880.   <xsl:template name="templ_prop_AuthorsSeparator" >
  881.     <xsl:param name="LCID" />
  882.     <xsl:variable name="_LCID">
  883.       <xsl:call-template name="localLCID">
  884.         <xsl:with-param name="LCID" select="$LCID"/>
  885.       </xsl:call-template>
  886.     </xsl:variable>
  887.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:AuthorsSeparator"/>
  888.   </xsl:template>
  889.  
  890.   
  891.   <xsl:template name="templ_prop_Space" >
  892.     <xsl:param name="LCID" />
  893.     <xsl:variable name="_LCID">
  894.       <xsl:call-template name="localLCID">
  895.         <xsl:with-param name="LCID" select="$LCID"/>
  896.       </xsl:call-template>
  897.     </xsl:variable>
  898.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:Space"/>
  899.   </xsl:template>
  900.  
  901.   
  902.   <xsl:template name="templ_str_AndOthersUnCap" >
  903.     <xsl:param name="LCID" />
  904.     <xsl:variable name="_LCID">
  905.       <xsl:call-template name="localLCID">
  906.         <xsl:with-param name="LCID" select="$LCID"/>
  907.       </xsl:call-template>
  908.     </xsl:variable>
  909.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Strings/b:AndOthersUnCap"/>
  910.   </xsl:template>
  911.  
  912.   
  913.   <xsl:template name="templ_prop_EndChars" >
  914.     <xsl:param name="LCID" />
  915.     <xsl:variable name="_LCID">
  916.       <xsl:call-template name="localLCID">
  917.         <xsl:with-param name="LCID" select="$LCID"/>
  918.       </xsl:call-template>
  919.     </xsl:variable>
  920.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:EndChars"/>
  921.   </xsl:template>
  922.  
  923.   
  924.   <xsl:template name="templ_prop_Dot" >
  925.     <xsl:param name="LCID" />
  926.     <xsl:variable name="_LCID">
  927.       <xsl:call-template name="localLCID">
  928.         <xsl:with-param name="LCID" select="$LCID"/>
  929.       </xsl:call-template>
  930.     </xsl:variable>
  931.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:Dot"/>
  932.   </xsl:template>
  933.  
  934.   
  935.   <xsl:template name="templ_prop_Authors_FML" >
  936.     <xsl:param name="LCID" />
  937.     <xsl:variable name="_LCID">
  938.       <xsl:call-template name="localLCID">
  939.         <xsl:with-param name="LCID" select="$LCID"/>
  940.       </xsl:call-template>
  941.     </xsl:variable>
  942.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:FML"/>
  943.   </xsl:template>
  944.  
  945.   
  946.   <xsl:template name="templ_prop_Authors_FM" >
  947.     <xsl:param name="LCID" />
  948.     <xsl:variable name="_LCID">
  949.       <xsl:call-template name="localLCID">
  950.         <xsl:with-param name="LCID" select="$LCID"/>
  951.       </xsl:call-template>
  952.     </xsl:variable>
  953.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:FM"/>
  954.   </xsl:template>
  955.  
  956.   
  957.   <xsl:template name="templ_prop_Authors_ML" >
  958.     <xsl:param name="LCID" />
  959.     <xsl:variable name="_LCID">
  960.       <xsl:call-template name="localLCID">
  961.         <xsl:with-param name="LCID" select="$LCID"/>
  962.       </xsl:call-template>
  963.     </xsl:variable>
  964.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:ML"/>
  965.   </xsl:template>
  966.  
  967.   
  968.   <xsl:template name="templ_prop_Authors_FL" >
  969.     <xsl:param name="LCID" />
  970.     <xsl:variable name="_LCID">
  971.       <xsl:call-template name="localLCID">
  972.         <xsl:with-param name="LCID" select="$LCID"/>
  973.       </xsl:call-template>
  974.     </xsl:variable>
  975.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:FL"/>
  976.   </xsl:template>
  977.  
  978.   
  979.   <xsl:template name="templ_prop_Hyphens" >
  980.     <xsl:param name="LCID" />
  981.     <xsl:variable name="_LCID">
  982.       <xsl:call-template name="localLCID">
  983.         <xsl:with-param name="LCID" select="$LCID"/>
  984.       </xsl:call-template>
  985.     </xsl:variable>
  986.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:Hyphens"/>
  987.   </xsl:template>
  988.  
  989.   
  990.   <xsl:template name="templ_prop_DotInitial" >
  991.     <xsl:param name="LCID" />
  992.     <xsl:variable name="_LCID">
  993.       <xsl:call-template name="localLCID">
  994.         <xsl:with-param name="LCID" select="$LCID"/>
  995.       </xsl:call-template>
  996.     </xsl:variable>
  997.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:DotInitial"/>
  998.   </xsl:template>
  999.  
  1000.  
  1001. </xsl:stylesheet>
  1002.  
  1003.