xsl-list
[Top] [All Lists]

[xsl] Re: xsl-list Digest 29 Jul 2008 05:10:01 -0000 Issue 1572

2008-07-29 07:36:10
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:strip-space elements="*" />
<xsl:output method="html" encoding="UTF-8"/>
<xsl:key name="cat_name" match="category" use="."
/>

<!--Games -->
<xsl:template name="body" match="/">
    <xsl:choose>
             <xsl:when test="rss/channel/generator =
'Systems'">
<!--Generates a unique id based on category name-->
<xsl:for-each select="//category[generate-id() = 
generate-id(key('cat_name',.)[1])]">
  <xsl:value-of select="." /><br/>
    <xsl:for-each select="key('cat_name',.)">
       <a href="#{generate-id()}">
        <xsl:value-of select="../title" /><br/>
       </a>
    </xsl:for-each>
</xsl:for-each>
 <!-- Generates Table of Contents with content links-->
     <br/><br/>
           <!-- Description - Builds anchor links based on title, but links are 
broken -->
                        <xsl:for-each select="rss/channel/item">
            <xsl:variable name="link-path" select="title"/>
            <b class="abbott_hl2"><xsl:value-of select="title"/></b><br/>
            <xsl:if test="description!=''">
            <a name="{generate-id()}"/>
              <xsl:value-of select="description"/><xsl:text>   </xsl:text>
              <a href="{$link-path}" target="_blank" 
class="abbott_storyurl">Click here for
fulltext</a><br/><br/>
            </xsl:if>
            </xsl:for-each>   
          <!-- End Description -->
  </xsl:when>

  </xsl:choose>
</xsl:template>
</xsl:stylesheet>


<?xml version="1.0" encoding="UTF-8"?>
<rss>
   <channel>
      <generator>Systems</generator>

      <item>
         <title>Ogre Battle is sold out</title>

         <description>There is a high demand for this rare game. It was made 
for the SNES and Nintendo 64. This game was unique in that your ending was 
based on your gameplay. You chose to progress as evil or good. But you could 
not be too good or too evil.</description>

         <category>SNES</category>

         <category>SEGA Genesis</category>
      </item>

      <item>
         <title>Final Fantasy 3 Breaks FF2 Record</title>

         <description>It was thought impossible to outdo FF2 gameplay. Square 
basically used the old engine from FF2 and enhanced it in FF3. There was the 
option for two players to play simultaneously against monsters.</description>

         <category>SNES</category>
      </item>

      <item>
         <title>SNES is the Ultimate System</title>

         <description>This new system has revolutionized controller design. 
There may have been another system with the 4 button setup on the right hand 
side surface of the game controller with 2 top buttons to make it 6 in all. The 
square edges were rounded off to provide a more comfortable 
experience.</description>

         <category>SNES</category>
      </item>

      <item>
         <title>Sonic The Hedgehog an instant success</title>

         <description>A new Mario is been born. It seems that the music on the 
Genesis was a notch a better than the SNES. Sonic The Hedgehog delivered in 
gameplay, graphics, fun factor, and sound.</description>

         <category>SEGA Genesis</category>
      </item>

      <item>
         <title>Joe Montanna Talking Football is amazing</title>

         <description>Listen play by play in this new form of football game. 
Play-by-Play commentary was a pleasant surprise for gamers who were used to 
blurry one-liners every 15 minutes. The side view made it feel just like NFL 
Sunday.</description>

         <category>SEGA Genesis</category>
      </item>
   </channel>
</rss>


Thanks Mukul, I added in the logic you provided and now the titles that contain 
multiple <category> elments now are listed under those categories.   Great :)  

But, now the anchor links are broken.  When I click on a hyperlink, the output 
of the <title> element, it should take me down to the corresponding title and 
description.  

Any ideas on this? 

I'm using the Cooktop development environment.  Its a
freeware, and not supported anymore, but still works
nicely.
Processor Version: XSLT Processor VersionVendor:
TransformiixVendor 

version="1.0"



      


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>