I have an application whose data resides in an Access database. The
application bascially loops through a number of categories, and for each
item ("news_post") in each category, loops through and transforms the
data into HTML. What I am trying to do is capture the value of the
"category" variable and pass it outside the current scope so I can link
to another page with more content relevant to the specific category.
I don't know how to either declare the variable in a scope that will
achieve my purpose, or pass the value through.
http://iisstage.pacific.edu/homepage/events/pacific-event-calendar.asp
Above is a link to the output and here's the code below. Any help would
be appreciated.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ms="urn:schemas-microsoft-com:xslt">
<xsl:output method="html"/>
<xsl:template match="/">
<div>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="news_posts">
<!-- check for empty node - no posts found - give error
message if not -->
<xsl:if test="not(node())">
<tr>
<xsl:text
disable-output-escaping="yes"><td width="100%"
valign="top"></xsl:text>
No events are currently scheduled.
<xsl:text
disable-output-escaping="yes"></td></xsl:text>
</tr>
</xsl:if>
<!-- display posts if found -->
<xsl:variable name="pagename">
<xsl:value-of select="../page_info/@pagename"/>
</xsl:variable>
<xsl:variable name="single">
<xsl:value-of
select="../page_info/@singlepost"/>
</xsl:variable>
<!-- output only first 2 posts -->
<xsl:choose>
<xsl:if test="count(news_post) < 3">
<!-- end test count value -->
<xsl:text>News post count 1A: </xsl:text>
<xsl:value-of disable-output-escaping="yes"
select="count(news_post)"></xsl:value-of><br />
<xsl:for-each select="news_post">
<xsl:sort order="ascending" select="."/>
<xsl:attribute
name="id"><xsl:text>zNews</xsl:text><xsl:value-of
select="position()"/></xsl:attribute>
<tr>
<xsl:text
disable-output-escaping="yes"><td valign="top" width="33%"
class='zcontent'></xsl:text>
<xsl:value-of select="short"
disable-output-escaping="yes" />
<xsl:text
disable-output-escaping="yes"></td></xsl:text>
<xsl:text
disable-output-escaping="yes"><td valign="top" width="66%"
class='zcontent'></xsl:text>
<div class="zheadline">
<a class="zheadtitleUnderline">
<xsl:attribute
name="href">
<xsl:text>mainevents.asp?postid=</xsl:text>
<xsl:value-of
select="@postid" />
</xsl:attribute>
<xsl:value-of
select="title" disable-output-escaping="yes" />
</a>
</div>
<xsl:text
disable-output-escaping="yes"></td></xsl:text>
<!-- check value -->
<xsl:value-of select="news_post"
disable-output-escaping="yes"/>
<xsl:text
disable-output-escaping="yes"></tr></xsl:text>
<!-- print test count value -->
<xsl:text
disable-output-escaping="yes"></td></xsl:text>
</tr>
<!--</xsl:if>-->
</xsl:for-each>
<!-- end test for number of posts -->
</xsl:if>
<xsl:if test="$nPosts > 1">
<tr>
<xsl:text
disable-output-escaping="yes"><td colspan=2 valign ="top"
width="100%" class='zcontent'></xsl:text>
<div align="right">
<xsl:text
disable-output-escaping="yes"><a href='pacific-</xsl:text>
<xsl:value-of
select="category" disable-output-escaping="yes" />
<!--<xsl:value-of
select="$nCategory" disable-output-escaping="yes" />-->
<xsl:text
disable-output-escaping="yes">-events.asp'>more
>></a></xsl:text>
</div>
<xsl:text
disable-output-escaping="yes"></td></xsl:text>
</tr>
</xsl:if>
Brian Phelps
Web Manager
Marketing and University Relations
(209) 946-3273 PST
For current web site updates, stay informed:
http://www.pacific.edu/developers/
AIM/Yahoo IM: btphelps
icq: 221376
University of the Pacific
Stockton, CA
www.pacific.edu
--~------------------------------------------------------------------
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>
--~--