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