Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Some calculation

From: "Dimitre Novatchev" <dimitren@---.---.-->
To: NULL
Date: 9/2/2007 9:53:00 PM

> What I'd like to do is to have another column that would look up
> Rating, and convert the value 80 into ****, the way iTunes does. (zero
> to 5 stars = nothing, 20, 40, 60, 80, & 100)


Use:

   substring($vStars, 1, $vI div 20)

where $vStars and $vI are global variables defined as follows:

 <xsl:variable name="vStars" select="'*****'"/>

 <xsl:variable name="vI" select="80"/>



Cheers,
Dimitre Novatchev


"Howard Brazee" <howard@b...> wrote in message 
news:vg29d3p06ii7a31s4rahbo53vrmcic4p3q@4......
> The following reads my iTunes Music Library.xml:
>
>
>
> What I'd like to do is to have another column that would look up
> Rating, and convert the value 80 into ****, the way iTunes does. (zero
> to 5 stars = nothing, 20, 40, 60, 80, & 100)
>
> =============================================
> Here's my current XML, followed by a segment of my iTunes Music
> Library.xml
>
> <?xml version="1.0" encoding="utf-8"?>
> <xsl:stylesheet version="1.0"
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
>  <!-- match the wrapper and apply templates to the <incl> xml file
> -->
>  <xsl:template match="/wrapper">
>    <xsl:apply-templates select="document(incl/@file)"/>
>  </xsl:template>
>
> <xsl:key name="songsByAlbum" match="dict"
>  use="string[preceding-sibling::key[1]='Album']"/>
>
> <xsl:template match="/plist/dict/dict">
>  <html>
>    <body>
>      <table>
>
>        <xsl:for-each select="dict[generate-id(.)=
>            generate-id(key('songsByAlbum',string)[1])]">
>          <xsl:sort
> select="string[preceding-sibling::key[1]='Album']"/>
>          <tr>
>            <td><xsl:value-of
> select="string[preceding-sibling::key[1]='Album']"/></td>
>            <td><xsl:value-of
> select="string[preceding-sibling::key[1]='Artist']"/></td>
>          </tr>
>        </xsl:for-each>
>
>      </table>
>    </body>
>  </html>
> </xsl:template>
>
>
> </xsl:stylesheet>
>
> ==============================
> This produces
> A Little Moonlight Dianne Reeves
>
> from
> =================================
> <key>1129</key>
> <dict>
> <key>Track ID</key><integer>1129</integer>
> <key>Name</key><string>Loads Of Love</string>
> <key>Artist</key><string>Dianne
> Reeves</string>
> <key>Composer</key><string>Richard
> Rodgers</string>
> <key>Album</key><string>A Little
> Moonlight</string>
> <key>Genre</key><string>Jazz</string>
> <key>Kind</key><string>Apple Lossless audio
> file</string>
> <key>Size</key><integer>25290093</integer>
> <key>Total Time</key><integer>264386</integer>
> <key>Disc Number</key><integer>1</integer>
> <key>Disc Count</key><integer>1</integer>
> <key>Track Number</key><integer>1</integer>
> <key>Track Count</key><integer>10</integer>
> <key>Year</key><integer>2003</integer>
> <key>Date
> Modified</key><date>2007-05-14T13:36:33Z</date>
> <key>Date
> Added</key><date>2007-04-24T13:09:16Z</date>
> <key>Bit Rate</key><integer>764</integer>
> <key>Sample Rate</key><integer>44100</integer>
> <key>Play Count</key><integer>2</integer>
> <key>Play
> Date</key><integer>3264067343</integer>
> <key>Play Date
> UTC</key><date>2007-06-07T19:22:23Z</date>
> <key>Rating</key><integer>80</integer>
> <key>Sort Album</key><string>Little
> Moonlight</string>
> <key>Persistent
> ID</key><string>C3364E67232519D7</string>
> <key>Track Type</key><string>File</string>
>
> <key>Location</key><string>file://localhost/C:/Documents%20and%20Settings/brazee/My%20Documents/My%20Music/iTunes/iTunes%20Music/Dianne%20Reeves/A%20Little%20Moonlight/01%20Loads%20Of%20Love.m4a</string>
> <key>File Folder
> Count</key><integer>4</integer>
> <key>Library Folder
> Count</key><integer>1</integer>
> </dict> 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent