I've created my first RSS feed, customized for a specific document type. I'd like to use the same RSS template site wide, but have it call a different customized macro/XSLT. Or, I could have one large XSLT file with conditional templates?
What are some ideas of how to condense and streamline my future feeds?
I like your idea. I haven't used templates much, but now see the power in them.
I'm having a problem using this however. If I take the variables out of the if statement, they work. The id is correct. Even testing for 1=1 does not work.
The reason that doesn't work is because you're probably trying to access the variable outside of the <xsl:if>, but unfortunately they're no longer in scope by then...
If you need deifferent values for the different feeds, try this approach - creating an XML "mapper" variable that you can query for the needed data:
<xsl:variable name="channel-mapper">
<channel id="3530">
<rssTitle>Arizona Attorney Magazine News Center</rssTitle>
<documentTypeAlias>LegalNewsHeadline</documentTypeAlias>
<numberOfItems>20</numberOfItems>
<rssDescription>Headlines gathered by the Arizona Attorney Magazine staff</rssDescription>
<rssLanguage>English</rssLanguage>
</channel>
<channel id="3802">
<rssTitle>Other title</rssTitle>
<documentTypeAlias>LegalNewsHeadline</documentTypeAlias>
<numberOfItems>20</numberOfItems>
<rssDescription>Headlines for other stuff</rssDescription>
<rssLanguage>English</rssLanguage>
</channel>
</xsl:variable>
<xsl:variable name="channelData" select="make:node-set($channel-mapper)/channel" />
<xsl:template match="/">
<xsl:variable name="currentChannel" select="channelData/channel[@id = $currentPage/@id]" />
<!-- Output stuff from the currentChannel -->
<xsl:value-of select="$currentChannel/rssTitle" />
</xsl:template>
One RSS Template, Multiple XSLTs?
I've created my first RSS feed, customized for a specific document type. I'd like to use the same RSS template site wide, but have it call a different customized macro/XSLT. Or, I could have one large XSLT file with conditional templates?
What are some ideas of how to condense and streamline my future feeds?
Hi Connie,
It should be quite possible to use a single file for this - consider this (pseudo XSLT):
This file could generate two separate RSS feeds, by supplying a macro parameter with the name of the section to process.
/Chriztian
I like your idea. I haven't used templates much, but now see the power in them.
I'm having a problem using this however. If I take the variables out of the if statement, they work. The id is correct. Even testing for 1=1 does not work.
Hi Connie,
The reason that doesn't work is because you're probably trying to access the variable outside of the <xsl:if>, but unfortunately they're no longer in scope by then...
If you need deifferent values for the different feeds, try this approach - creating an XML "mapper" variable that you can query for the needed data:
/Chriztian
is working on a reply...