Enjoy Every Sandwich

Thoughts on SQL, XML, .NET and sometimes beer.

<August 2008>
SuMoTuWeThFrSa
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456


Navigation

Tools

List O'Links

Kent's Other Stuff

Subscriptions

News

Please read these
Notices and Disclamiers

Post Categories

Article Categories



Take Outs: The Stylesheet

I'll gladly admit to being lazy. I do, in fact, use an XSLT to generate the body of Takeouts. Basically, I fire up XML spy, load RSS Bandit's FeedItems XML file, load the following stylesheet and apply. The result goes into FrontPage for editing and sorting, then gets cut and pasted into .Text via IE.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:bandit="http://www.25hoursaday.com/2003/RSSBandit/feeds/">
<xsl:output method="html" omit-xml-declaration="yes" standalone="yes" />
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
        <p>Say something witty here, if you can.</p>
        <table cellpadding="3" cellspacing="0" border="1">
        <tr>
            <th>Item</th>
            <th>Category</th>
            <th><img src="http://www.tegels.org/rss.gif" 
                border="0" alt="RSS" /></th>
            <th>Comments</th>            
        </tr>
        <xsl:for-each select="/rss/channel/item">
            <xsl:sort select="title" />
            <tr class="takeoutrow">
                <td class="takeoutcell">
                    <a target="_blank">
                        <xsl:attribute name="href">
                            <xsl:value-of select="link" />
                        </xsl:attribute>
                        <xsl:value-of select="title" 
                         disable-output-escaping="yes"/>
                    </a>
                </td>
                <td class="takeoutcell">Cat</td>
                <td class="takeoutcell">
                    <a>
                        <xsl:attribute name="href">
                            <xsl:value-of select="bandit:feed-url" />
                        </xsl:attribute>
                        <img src="http://www.tegels.org/rss.gif" border="0" 
                         alt="RSS" />
                    </a>
                </td>
                <td class="takeoutcell">Comment</td>
            </tr> 
        </xsl:for-each>        
        </table>
    <p><strong>As always:</strong> your feedback is welcome below. Thanks!</p>
    </xsl:template>
</xsl:stylesheet>

Its not the best XSLT ever done either, but it works well enough for now.

 

posted on Tuesday, February 17, 2004 9:58 AM by ktegels





Powered by Dot Net Junkies, by Telligent Systems