[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: compare out of context?

Subject: RE: compare out of context?
From: "Thomas Vanparys" <thomas.vanparys@xxxxxxxxxx>
Date: Tue, 2 Nov 2004 23:43:13 +0100
xsl compare
Hi again,

I found an answer: passing parameters in the template calls all the way down
to the point I need them.

I'm pretty sure my code looks aweful at this point but it works. If anyone
has any tips on how I could optimise the routine I'm all ears.


-------[BEGIN SOURCE XSL]--------

<xsl:stylesheet version="1.0"
<xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.0

<xsl:key name="artists" match="mp3" use="artist/displayname" />
<xsl:key name="albums" match="mp3" use="album/displayname" />
<xsl:key name="artists_albums" match="mp3" use="concat(artist/displayname, '

<xsl:template match="mp3list">
          .header { font-size: larger; font-weight: bold; cursor: hand;
                     background-color:#cccccc; font-family: Verdana; }
          .details { background-color:#eeeeee; font-family: Verdana; }
          .fadeout { color:#F0C2BB; }

      <xsl:for-each select="mp3[count(. | key('artists',
artist/displayname)[1]) = 1]">
        <xsl:sort select="artist/displayname" />
        <xsl:variable name="top_artist" select="artist/displayname" />
        <h1><xsl:value-of select="$top_artist" /></h1>

             select="key('artists', artist/displayname)" />

        <xsl:for-each select="$album_items[generate-id() =
generate-id(key('artists_albums', concat(artist/displayname, ' ',
          <xsl:sort select="album/displayname" />
          <xsl:call-template name="album_title"/>
          <xsl:call-template name="album_content">
            <xsl:with-param name="passed_param">
              <xsl:value-of select="$top_artist"/>


      <xsl:call-template name="page_footer"/>


<xsl:template name="album_title">
  <xsl:element name="h3">
  <xsl:attribute name="id"><xsl:value-of select="concat('h',generate-id(.))"
    <xsl:attribute name="class">header</xsl:attribute>
    <xsl:value-of select="album/displayname" />

<xsl:template name="album_content">
  <xsl:param name="passed_param"/>
  <xsl:element name="div">
    <xsl:attribute name="id"><xsl:value-of
select="concat('d',generate-id(.))" /></xsl:attribute>
    <xsl:attribute name="class">details</xsl:attribute>
      <xsl:for-each select="key('albums', album/displayname)">
        <xsl:sort select="trackindex" data-type="number"/>
        <xsl:call-template name="highlighter">
          <xsl:with-param name="passed_param">
            <xsl:value-of select="$passed_param"/>
        <td><xsl:number format="01 " value="trackindex"/></td>
        <td><xsl:value-of select="title"/></td>
        <td><xsl:value-of select="length"/></td>
        <td><xsl:value-of select="bitrate"/></td>
        <td><xsl:value-of select="vbr"/></td>

<xsl:template name="highlighter">
  <xsl:param name="passed_param" select="'Default Data'"/>
  <xsl:if test="$passed_param != artist/displayname">
    <xsl:attribute name="class">fadeout</xsl:attribute>

<xsl:template name="page_footer">


-------[END SOURCE XSL]--------

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.