Due to enormous amounts of spam, the forum has been set to read-only mode.



Reply to topic  [ 24 posts ]  Go to page Previous  1, 2, 3
Change album artist with track artist 
Author Message
Site Admin
User avatar

Joined: Fri Nov 22, 2002 3:52 pm
Posts: 13748
Post Re: Change album artist with track artist

Litago wrote:
Code:
<xsl:variable name="unique-artistlist"  select="//track/artists/artist/name[not(.=following::track/artists/artist/name)]"/>
<xsl:for-each select="$unique-artistlist">
  <xsl:value-of select="."/>
  <xsl:if test="position() &lt; last() ">
    <xsl:text> / </xsl:text>
  </xsl:if>                 
</xsl:for-each>


Hi,
I didn't understand the use of this at first, but it looks like some useful code to have in an overview section. Now, would it be possible to limit the list by including a criterion?
Like, only list artists from the same "work". A "work" is distinguished by having a common Custom01

As far as I know, this is not possible using this technique.

_________________
Fredrik Nordbakke
www.fnprg.com


Wed Sep 05, 2012 10:33 am
Profile WWW

Joined: Wed Jun 16, 2010 3:01 pm
Posts: 18
Post Re: Change album artist with track artist

Thanx anyway,

I thought it would be useful to illustrate what I’m trying to accomplish.
This is how my Album_Tracks.xsl works today:
The Tchaikovsky is OK, showing all participants in the ‘Table of Contents’:
Image

My problem starts with Mahler:
Image
Here the soloists don't show up. That's because they are not listed in the first track of the work.
To be perfect the code must go through all tracks belonging to the work and list the unique participants.

Here is the code used today:
Code:
<xsl:template match="track" mode="toc">
    <xsl:if test="custom01!='' and custom10/@bool='True'">     
       <TR CLASS="tablerecordsrow" style="vertical-align:middle">
             <TD colspan="2" bgcolor="#B7D0A3" style="padding-left: 20px; padding-top: 4px; height: 22px;">
                  <A HREF="PLAYFILTER:Track.custom01={custom01}@Track.AlbumID={albumid/@unformatted}@orderby=Track.Position@validate=yes,1"> <IMG SRC="PlayAlbum.gif" BORDER="0"/> </A>
             </TD>

             <TD bgcolor="#B7D0A3" style="font-weight:bold; font-size:12px">
                  <A HREF="TrackList.xsl?custom01={custom01}@xslparam:doctitle={/data/fld/track/custom01/@name}:{custom01}">
                  <xsl:value-of select="custom01"/>
                  </A>
             </TD>
                   
            <TD NOWRAP="" bgcolor="#B7D0A3" ALIGN="LEFT" style="font-weight: bold; padding-right: 5px">
               <xsl:call-template name="format-artist">
               <xsl:with-param name="artists" select="artists"/>
               </xsl:call-template>
            </TD>

             <TD bgcolor="#B7D0A3" ALIGN="RIGHT" style="font-weight: bold">
                <xsl:if test="custom10/@bool='True'">
                     <xsl:variable name="custom01value"><xsl:value-of select="custom01"/></xsl:variable>   
                     <xsl:variable name="totallengthmin"><xsl:value-of select="sum(//track[custom01=$custom01value]/length/@minutes) * 60"/></xsl:variable>
                     <xsl:variable name="totallengthsec"><xsl:value-of select="sum(//track[custom01=$custom01value]/length/@seconds)"/></xsl:variable>
                     <xsl:variable name="totallength"><xsl:value-of select="$totallengthmin + $totallengthsec"/></xsl:variable>
                     <xsl:value-of select="floor($totallength div 60)"/><xsl:text>:</xsl:text><xsl:value-of select="format-number($totallength mod 60, '00')"/>
                </xsl:if>
             </TD>

             <xsl:variable name="nworks"> <xsl:value-of select="count(//custom10[@bool='True'])"/> </xsl:variable>
             <td bgcolor="#B7D0A3" align="center">
              <Font color="#7D0A3B">
                   
          <xsl:for-each select="guestmusicians/guestmusician">
                        <A HREF="ArtistPerson.xsl?ID={@id}" TARGET="_BLANK"><xsl:value-of select="name"/>
                        </A>
                        <xsl:text>  </xsl:text>
                        <xsl:for-each select="instruments/instrument">
                            <xsl:value-of select="."/>
                            <xsl:if test="position()&lt; last()">
                              <xsl:text> / </xsl:text>
                            </xsl:if>
                        </xsl:for-each>
                        <br/>
          </xsl:for-each>                 
                 
          <xsl:for-each select="bandmembers/bandmember">       
            <A HREF="ArtistPerson.xsl?ID={@id}" TARGET="_BLANK"> <xsl:value-of select="name"/> </A>
            <br/>
          </xsl:for-each>
           
           <xsl:for-each select="conductorcredits/conductorcredit">
              <A HREF="ArtistPerson.xsl?ID={@id}" TARGET="_BLANK"> <xsl:value-of select="name"/> </A>
                   <xsl:text>  </xsl:text>
                   <xsl:for-each select="roles/role">      
                     <xsl:value-of select="."/>
                     <xsl:choose>
                        <xsl:when test="position()&lt; last()">
                           <xsl:text> / </xsl:text>
                        </xsl:when>
                        <xsl:otherwise>
                           <BR/>
                        </xsl:otherwise>
                     </xsl:choose>
                   </xsl:for-each>             
           </xsl:for-each>                             
               </Font>

         </td>
                           
       <xsl:if test="index='1' and ../../itemno='1'">
         <xsl:choose>
           <xsl:when test="$nworks &lt; 2">
              <TD rowspan="{$nworks}" colspan="2" align="right" style="vertical-align:top">
                         <A HREF="CMD:VIEWIMAGE:Album,{/data/record/albumdata/albumid/@unformatted},1"><IMG BORDER="0" height="96" SRC="{/data/record/albumdata/image1/filename}"/></A>
               </TD>
           </xsl:when>         
           <xsl:when test="$nworks &gt; 4">
              <TD rowspan="{$nworks}" colspan="2" align="right" style="vertical-align:top">
                         <A HREF="CMD:VIEWIMAGE:Album,{/data/record/albumdata/albumid/@unformatted},1"><IMG BORDER="0" height="240" SRC="{/data/record/albumdata/image1/filename}"/></A>
               </TD>
           </xsl:when>       
           <xsl:otherwise>
               <TD rowspan="{$nworks}" colspan="2" align="right" style="vertical-align:top">
                                  <A HREF="CMD:VIEWIMAGE:Album,{/data/record/albumdata/albumid/@unformatted},1"><IMG BORDER="0" height="{57*$nworks}" SRC="{/data/record/albumdata/image1/filename}"/></A>
               </TD> 
           </xsl:otherwise>
         </xsl:choose>

       </xsl:if>
                         
     </TR>
   </xsl:if> 
</xsl:template>


Anyone having an alternative approach to this, which solves my problem?

Litago


You do not have the required permissions to view the files attached to this post.


Fri Sep 07, 2012 4:31 pm
Profile
User avatar

Joined: Fri Nov 14, 2003 6:15 pm
Posts: 1425
Post Re: Change album artist with track artist

Litago wrote:
Here the soloists don't show up. That's because they are not listed in the first track of the work.
To be perfect the code must go through all tracks belonging to the work and list the unique participants.
...
Anyone having an alternative approach to this, which solves my problem?

The alternative I prefer uses <xsl:key>, but it is possible to make the present approach work pretty well for what you are trying to do. However, there are still some limitations with this approach. One that comes to mind is if a guest musician first appears in a work playing piano and appears on a later track in the same work playing fortepiano then only piano will show. If both instruments are entered on the first track where the guest musician appears then both instruments will appear.

My additions and changes to your code are highlighted in blue. Give this a good test with your database since I don't have a suitable test case here.

Code:
               <xsl:variable name="_thiswork" select="custom01"/>
               <xsl:variable name="unique-guestmusician" select="//track[custom01=$_thiswork]/guestmusicians/guestmusician/name[not(.=preceding::track[custom01=$_thiswork]/guestmusicians/guestmusician/name)]/.."/>
               <xsl:variable name="unique-bandmember" select="//track[custom01=$_thiswork]/bandmembers/bandmember/name[not(.=preceding::track[custom01=$_thiswork]/bandmembers/bandmember/name)]/.."/>
               <xsl:variable name="unique-conductorcredit" select="//track[custom01=$_thiswork]/conductorcredits/conductorcredit/name[not(.=preceding::track[custom01=$_thiswork]/conductorcredits/conductorcredit/name)]/.."/>

               <xsl:for-each select="$unique-guestmusician">
                 <A HREF="ArtistPerson.xsl?ID={@id}" TARGET="_BLANK"><xsl:value-of select="name"/>
                 </A>
                 <xsl:text>  </xsl:text>
                 <xsl:for-each select="instruments/instrument">
                   <xsl:value-of select="."/>
                   <xsl:if test="position()&lt; last()">
                     <xsl:text> / </xsl:text>
                   </xsl:if>
                 </xsl:for-each>
                 <br/>
               </xsl:for-each>
               
               <xsl:for-each select="$unique-bandmember">
                 <A HREF="ArtistPerson.xsl?ID={@id}" TARGET="_BLANK"> <xsl:value-of select="name"/> </A>
                 <br/>
               </xsl:for-each>
               
               <xsl:for-each select="$unique-conductorcredit">
                 <A HREF="ArtistPerson.xsl?ID={@id}" TARGET="_BLANK"> <xsl:value-of select="name"/> </A>
                 <xsl:text>  </xsl:text>
                 <xsl:for-each select="roles/role">
                   <xsl:value-of select="."/>
                   <xsl:choose>
                     <xsl:when test="position()&lt; last()">
                       <xsl:text> / </xsl:text>
                     </xsl:when>
                     <xsl:otherwise>
                       <BR/>
                     </xsl:otherwise>
                   </xsl:choose>
                 </xsl:for-each>
               </xsl:for-each>
 

_________________
Cheers,
Dave


Sat Sep 08, 2012 8:21 pm
Profile WWW

Joined: Wed Jun 16, 2010 3:01 pm
Posts: 18
Post Re: Change album artist with track artist

Fantastic,
This is more than I hoped for.
Now the vocalists can hide no more.
Mahler is now OK, Busoni is OK, Holst is OK and Tchaikovsky is still OK. They’re all OK.
Image
With time my brain also will come out of the knot it’s spun into looking at this code.
Thanx.
Litago


You do not have the required permissions to view the files attached to this post.


Mon Sep 10, 2012 4:32 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 24 posts ]  Go to page Previous  1, 2, 3

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.