 |
| XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

May 15th, 2009, 08:54 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
|
|
Here is an attempt to transform all comments so far into a working stylesheet:
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:key name="sortdate" match="item" use="docdate"/>
<xsl:param name="project"></xsl:param>
<xsl:template match="/" name="main">
<xsl:if test="//downloads/item[@category='meeting' or @category='agenda' or @category='summary']/program[@id=$project]">
<h3 class="sidebar">Meeting Information</h3>
<p style="margin: -8px 0 0 0; font-size: .8em; font-style: italic; color: #887">
(click on date to view documents)
</p>
<xsl:for-each select="/downloads/item[@category='meeting' or @category='agenda' or @category='summary'][generate-id(.)=generate-id(key('sortdate', docdate)[program/@id=$project][1])]/program[@id=$project]">
<xsl:variable name="myid" select="../docdate"/>
<a style="font-weight: bold" href="javascript:toggleDiv('{$myid}')">
<h4><xsl:call-template name="format-date"/></h4>
</a>
<div style="display:none; margin-bottom: 10px" id="{$myid}">
<table>
<xsl:for-each select="key('sortdate', ../docdate)">
<xsl:if test="position() mod 2 = 1">
<tr style="background-color: #fff; border: 0">
<td style="padding: 3px">
<a>
<xsl:attribute name="href"><xsl:value-of select="xref"/></xsl:attribute>
<xsl:value-of select="title"/>
</a>
<xsl:if test="docsize/mb != ''">
<small>
<xsl:value-of select="docsize/mb"/>.<xsl:value-of select="docsize/kb"/>Mb
</small>
</xsl:if>
<xsl:call-template name="otrfmt"/>
<xsl:if test="comment != ''">
<br/>
<small>
<xsl:value-of select="comment"/>
</small>
</xsl:if>
</td>
</tr>
</xsl:if>
<xsl:if test="position() mod 2 = 0">
<tr style="background-color: #ede5df; border: 0">
<td style="padding: 3px">
<a>
<xsl:attribute name="href"><xsl:value-of select="xref"/></xsl:attribute>
<xsl:value-of select="title"/>
</a>
<xsl:if test="docsize/mb != ''">
<small>
<xsl:value-of select="docsize/mb"/>.<xsl:value-of select="docsize/kb"/>Mb
</small>
</xsl:if>
<xsl:call-template name="otrfmt"/>
<xsl:if test="comment != ''">
<br/>
<small>
<xsl:value-of select="comment"/>
</small>
</xsl:if>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="format-date">
<xsl:variable name="d"><xsl:value-of select="../docdate" /></xsl:variable>
<xsl:call-template name="long_date"><xsl:with-param name="date" select="$d" /></xsl:call-template>
</xsl:template>
<xsl:template name="long_date">
<xsl:param name="date" />
<xsl:variable name="day" select="substring($date, 7, 2)" />
<xsl:choose>
<xsl:when test="$day=00"></xsl:when>
<xsl:when test="$day<32"><xsl:value-of select="substring($date, 7, 2)" /> </xsl:when>
<xsl:otherwise>INVALID DAY </xsl:otherwise>
</xsl:choose>
<xsl:variable name="month" select="substring($date, 5, 2)" />
<xsl:choose>
<xsl:when test="$month=01">January</xsl:when>
<xsl:when test="$month=02">February</xsl:when>
<xsl:when test="$month=03">March</xsl:when>
<xsl:when test="$month=04">April</xsl:when>
<xsl:when test="$month=05">May</xsl:when>
<xsl:when test="$month=06">June</xsl:when>
<xsl:when test="$month=07">July</xsl:when>
<xsl:when test="$month=08">August</xsl:when>
<xsl:when test="$month=09">September</xsl:when>
<xsl:when test="$month=10">October</xsl:when>
<xsl:when test="$month=11">November</xsl:when>
<xsl:when test="$month=12">December</xsl:when>
<xsl:otherwise>INVALID MONTH</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="substring($date, 1, 4)" />
</xsl:template>
<xsl:template name="otrfmt">
<xsl:choose>
<xsl:when test="docformat='PDF'">
<xsl:element name="a">
<xsl:attribute name="href">http://www.adobe.com/products/acrobat/readstep2.html</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">images/pdf_ico.jpg</xsl:attribute>
<xsl:attribute name="title">Click here to download/install Adobe PDF Reader</xsl:attribute>
<xsl:attribute name="alt">Click here to download/install Adobe PDF Reader</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='DOC'">
<xsl:element name="a">
<xsl:attribute name="href">http://www.microsoft.com/downloads/details.aspx?FamilyID=3657ce88-7cfa-457a-9aec-f4f827f20cac&DisplayLang=en</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">images/word_ico.jpg</xsl:attribute>
<xsl:attribute name="title">Click here to download/install MS Word Reader</xsl:attribute>
<xsl:attribute name="alt">Click here to download/install MS Word Reader</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='XLS'">
<xsl:element name="a">
<xsl:attribute name="href">http://www.microsoft.com/downloads/details.aspx?FamilyID=1cd6acf9-ce06-4e1c-8dcf-f33f669dbc3a&DisplayLang=en</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">images/xls_ico.jpg</xsl:attribute>
<xsl:attribute name="title">Click here to download/install MS Excel Reader</xsl:attribute>
<xsl:attribute name="alt">Click here to download/install MS Excel Reader</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='ZIP'">
<xsl:element name="a">
<xsl:attribute name="href">http://www.winzip.com/downwz.htm</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">images/zip_ico.jpg</xsl:attribute>
<xsl:attribute name="title">Click here to download/install WinZip</xsl:attribute>
<xsl:attribute name="alt">Click here to download/install WinZip</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='PPT'">
<xsl:element name="a">
<xsl:attribute name="href">http://www.microsoft.com/downloads/details.aspx?FamilyID=048dc840-14e1-467d-8dca-19d2a8fd7485&DisplayLang=en</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">images/ppt_ico.jpg</xsl:attribute>
<xsl:attribute name="title">Click here to install MS Powerpoint Reader</xsl:attribute>
<xsl:attribute name="alt">Click here to install MS Powerpoint Reader</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='JPG'">
<xsl:element name="img">
<xsl:attribute name="src">images/jpg_ico.jpg</xsl:attribute>
<xsl:attribute name="alt"></xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='MPG'">
<xsl:element name="img">
<xsl:attribute name="src">images/mpg_ico.jpg</xsl:attribute>
<xsl:attribute name="title">This is a MPEG/MPG multimedia file</xsl:attribute>
<xsl:attribute name="alt">This is a MPEG/MPG multimedia file</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='WMV'">
<xsl:element name="img">
<xsl:attribute name="src">images/wmv_ico.jpg</xsl:attribute>
<xsl:attribute name="title">This is a WMV multimedia file</xsl:attribute>
<xsl:attribute name="alt">This is a WMV multimedia file</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='TXT'">
<xsl:element name="img">
<xsl:attribute name="src">images/txt2_ico.jpg</xsl:attribute>
<xsl:attribute name="title">This is a Plain Text Format file</xsl:attribute>
<xsl:attribute name="alt">This is a Plain Text Format file</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='RTF'">
<xsl:element name="img">
<xsl:attribute name="src">images/txt_ico.jpg</xsl:attribute>
<xsl:attribute name="title">This is a Rich Text Format file</xsl:attribute>
<xsl:attribute name="alt">This is a Rich Text Format file</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='MDB'">
<xsl:element name="img">
<xsl:attribute name="src">images/mdb_ico.jpg</xsl:attribute>
<xsl:attribute name="title">This is a MS Access Database</xsl:attribute>
<xsl:attribute name="alt">This is a MS Access Database</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
When applied against this XML input
Code:
<downloads>
<item category="agenda">
<program id="rtcc">RTCC</program>
<docdate>20090219</docdate>
<title>agenda</title>
<desc>meeting agenda</desc>
<xref>ftp://ftp.tjcog.org/pub/tarpo/agendas/agd20090219_rtcc.pdf</xref>
<docformat>PDF</docformat>
<docsize>
<mb></mb>
<kb>91</kb>
</docsize>
<comment></comment>
<postdate>20090219</postdate>
</item>
<item category="summary">
<program id="rtcc">RTCC</program>
<docdate>20090219</docdate>
<title>summary</title>
<desc>meeting summary</desc>
<xref>ftp://ftp.tjcog.org/pub/tarpo/minutes/mm20090219_rtcc.pdf</xref>
<docformat>PDF</docformat>
<docsize>
<mb></mb>
<kb>91</kb>
</docsize>
<comment></comment>
<postdate>20090219</postdate>
</item>
<item category="meeting">
<program id="rtcc">RTCC</program>
<docdate>20090219</docdate>
<title>Item 4.1 - TARPO RTAC Resolution - Pittsboro 2009 CMAQ Project</title>
<desc>Item 4.1 - TARPO RTAC Resolution - Pittsboro 2009 CMAQ Project</desc>
<xref>ftp://ftp.tjcog.org/pub/tarpo/mtgmat/rtcc20090219_item4_1.pdf</xref>
<docformat>PDF</docformat>
<docsize>
<mb></mb>
<kb>91</kb>
</docsize>
<comment></comment>
<postdate>20090219</postdate>
</item>
<item category="agenda">
<program id="rtac">RTAC</program>
<docdate>20090219</docdate>
<title>agenda</title>
<desc>meeting agenda</desc>
<xref>ftp://ftp.tjcog.org/pub/tarpo/agendas/agd20090219.pdf</xref>
<docformat>PDF</docformat>
<docsize>
<mb></mb>
<kb>91</kb>
</docsize>
<comment></comment>
<postdate>20090219</postdate>
</item>
<item category="summary">
<program id="rtac">RTAC</program>
<docdate>20090219</docdate>
<title>summary</title>
<desc>meeting summary</desc>
<xref>ftp://ftp.tjcog.org/pub/tarpo/minutes/mm20090219.pdf</xref>
<docformat>PDF</docformat>
<docsize>
<mb></mb>
<kb>91</kb>
</docsize>
<comment></comment>
<postdate>20090219</postdate>
</item>
<item category="meeting">
<program id="rtac">RTAC</program>
<docdate>20090219</docdate>
<title>Item 5.1.1 - TARPO RTAC Resolution - Pittsboro 2009 CMAQ Project 2-19-09</title>
<desc>Item 5.1.1 - TARPO RTAC Resolution - Pittsboro 2009 CMAQ Project 2-19-09</desc>
<xref>ftp://ftp.tjcog.org/pub/tarpo/mtgmat/rtac20090219_item5_1_1.pdf</xref>
<docformat>PDF</docformat>
<docsize>
<mb></mb>
<kb>91</kb>
</docsize>
<comment></comment>
<postdate>20090219</postdate>
</item>
</downloads>
with project=rtac the output is as follows:
Code:
<h3 class="sidebar">Meeting Information</h3>
<p style="margin: -8px 0 0 0; font-size: .8em; font-style: italic; color: #887">
(click on date to view documents)
</p><a style="font-weight: bold" href="javascript:toggleDiv('20090219')">
<h4>19February2009</h4></a><div style="display:none; margin-bottom: 10px" id="20090219">
<table>
<tr style="background-color: #fff; border: 0">
<td style="padding: 3px"><a href="ftp://ftp.tjcog.org/pub/tarpo/agendas/agd20090219_rtcc.pdf">agenda</a><a href="http://www.adobe.com/products/acrobat/readstep2.html"><img src="images/pdf_ico.jpg" title="Click here to download/install Adobe PDF Reader" alt="Click here to download/install Adobe PDF Reader" class="dwnldimg"></a></td>
</tr>
<tr style="background-color: #ede5df; border: 0">
<td style="padding: 3px"><a href="ftp://ftp.tjcog.org/pub/tarpo/minutes/mm20090219_rtcc.pdf">summary</a><a href="http://www.adobe.com/products/acrobat/readstep2.html"><img src="images/pdf_ico.jpg" title="Click here to download/install Adobe PDF Reader" alt="Click here to download/install Adobe PDF Reader" class="dwnldimg"></a></td>
</tr>
<tr style="background-color: #fff; border: 0">
<td style="padding: 3px"><a href="ftp://ftp.tjcog.org/pub/tarpo/mtgmat/rtcc20090219_item4_1.pdf">Item 4.1 - TARPO RTAC Resolution - Pittsboro 2009 CMAQ Project</a><a href="http://www.adobe.com/products/acrobat/readstep2.html"><img src="images/pdf_ico.jpg" title="Click here to download/install Adobe PDF Reader" alt="Click here to download/install Adobe PDF Reader" class="dwnldimg"></a></td>
</tr>
<tr style="background-color: #ede5df; border: 0">
<td style="padding: 3px"><a href="ftp://ftp.tjcog.org/pub/tarpo/agendas/agd20090219.pdf">agenda</a><a href="http://www.adobe.com/products/acrobat/readstep2.html"><img src="images/pdf_ico.jpg" title="Click here to download/install Adobe PDF Reader" alt="Click here to download/install Adobe PDF Reader" class="dwnldimg"></a></td>
</tr>
<tr style="background-color: #fff; border: 0">
<td style="padding: 3px"><a href="ftp://ftp.tjcog.org/pub/tarpo/minutes/mm20090219.pdf">summary</a><a href="http://www.adobe.com/products/acrobat/readstep2.html"><img src="images/pdf_ico.jpg" title="Click here to download/install Adobe PDF Reader" alt="Click here to download/install Adobe PDF Reader" class="dwnldimg"></a></td>
</tr>
<tr style="background-color: #ede5df; border: 0">
<td style="padding: 3px"><a href="ftp://ftp.tjcog.org/pub/tarpo/mtgmat/rtac20090219_item5_1_1.pdf">Item 5.1.1 - TARPO RTAC Resolution - Pittsboro 2009 CMAQ Project 2-19-09</a><a href="http://www.adobe.com/products/acrobat/readstep2.html"><img src="images/pdf_ico.jpg" title="Click here to download/install Adobe PDF Reader" alt="Click here to download/install Adobe PDF Reader" class="dwnldimg"></a></td>
</tr>
</table>
</div>
I am afraid I have so far not understood what output you want to create but at least it might help you get a stylesheet without syntax errors.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
|
|

May 15th, 2009, 11:02 AM
|
|
Authorized User
|
|
Join Date: Oct 2008
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Thanks Martin for the help. I've gone back and made corrections to the stylesheet.
I'm trying to cull out meeting summaries and agendas on the fly for a particular project depending upon which project page you are on, RTAC or RTCC (or others, there are about 20 different projects). The list of dates should display from most recent to most distant. Right now it works as you have shown on every page in every other instance, save the RTAC and RTCC pages. The reason for this (or what seems to be the reason) is that these two committees are the only ones that have met on the same date.
What happens when I run this is that all the project data from the one date goes to one page (RTAC) and not the other (RTCC). All the other meeting dates on both pages work fine and separate out properly. If I change the meeting dates by one day or month so that they aren't the same, it works fine. Whenever the dates are identical for the two separate projects, this odd thing happens.
Since this is being called on the fly, i don't understand why it is working this way. I could understand both pages displaying nothing or both pages displaying both, so the output is completely illogical to me. I'm a rote beginner at this and not a programmer by trade, so I can easily see me missing the obvious, but I'm really at a loss for how to proceed. I've tried to place program[@id=$project] in various places or rework the 'for-each' statements, but with no joy. I either get more of the same or I break it completely.
|
|

May 15th, 2009, 11:55 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
|
|
Can you explain what is wrong with the result I posted? It is basically a h3 element followed by a p element followed by a link to toggle the display of a div with a table. If that is not the result you want then please post the result you want from the stylesheet.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
|
|

May 15th, 2009, 12:06 PM
|
|
Authorized User
|
|
Join Date: Oct 2008
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
All the items are showing up, not just the RTAC items. If you run the query with just the 'rtac' as input, only the RTAC stuff should show up (3 items). If you run the query with just the 'rtcc', a different set of 3 items should show.
|
|

May 15th, 2009, 12:29 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
|
|
The key only uses the date so that is why you get all items. If you change the key to include the program/@id then you should get only the items you are looking for.
I have also cleaned up some stuff:
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:key name="sortdate" match="item" use="concat(docdate, '|', program/@id)"/>
<xsl:param name="project"></xsl:param>
<xsl:template match="/" name="main">
<xsl:if test="//downloads/item[@category='meeting' or @category='agenda' or @category='summary']/program[@id=$project]">
<h3 class="sidebar">Meeting Information</h3>
<p style="margin: -8px 0 0 0; font-size: .8em; font-style: italic; color: #887">
(click on date to view documents)
</p>
<xsl:for-each select="/downloads/item[@category='meeting' or @category='agenda' or @category='summary'][generate-id(.)=generate-id(key('sortdate', concat(docdate, '|', $project))[1])]">
<xsl:variable name="myid" select="docdate"/>
<a style="font-weight: bold" href="javascript:toggleDiv('{$myid}')">
<h4>
<xsl:call-template name="format-date">
<xsl:with-param name="d" select="docdate"/>
</xsl:call-template>
</h4>
</a>
<div style="display:none; margin-bottom: 10px" id="{$myid}">
<table>
<xsl:for-each select="key('sortdate', concat(docdate, '|', $project))">
<tr>
<xsl:attribute name="style">
<xsl:choose>
<xsl:when test="position() mod 2 = 1">
<xsl:text>background-color: #fff; border: 0;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>background-color: #ede5df; border: 0;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td style="padding: 3px">
<a href="{xref}">
<xsl:value-of select="title"/>
</a>
<xsl:if test="docsize/mb != ''">
<small>
<xsl:value-of select="docsize/mb"/>.<xsl:value-of select="docsize/kb"/>Mb
</small>
</xsl:if>
<xsl:call-template name="otrfmt"/>
<xsl:if test="comment != ''">
<br/>
<small>
<xsl:value-of select="comment"/>
</small>
</xsl:if>
</td>
</tr>
</xsl:for-each>
</table>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="format-date">
<xsl:param name="d"/>
<xsl:call-template name="long_date"><xsl:with-param name="date" select="$d" /></xsl:call-template>
</xsl:template>
<xsl:template name="long_date">
<xsl:param name="date" />
<xsl:variable name="day" select="substring($date, 7, 2)" />
<xsl:choose>
<xsl:when test="$day=00"></xsl:when>
<xsl:when test="$day<32"><xsl:value-of select="substring($date, 7, 2)" /> </xsl:when>
<xsl:otherwise>INVALID DAY </xsl:otherwise>
</xsl:choose>
<xsl:variable name="month" select="substring($date, 5, 2)" />
<xsl:choose>
<xsl:when test="$month=01">January</xsl:when>
<xsl:when test="$month=02">February</xsl:when>
<xsl:when test="$month=03">March</xsl:when>
<xsl:when test="$month=04">April</xsl:when>
<xsl:when test="$month=05">May</xsl:when>
<xsl:when test="$month=06">June</xsl:when>
<xsl:when test="$month=07">July</xsl:when>
<xsl:when test="$month=08">August</xsl:when>
<xsl:when test="$month=09">September</xsl:when>
<xsl:when test="$month=10">October</xsl:when>
<xsl:when test="$month=11">November</xsl:when>
<xsl:when test="$month=12">December</xsl:when>
<xsl:otherwise>INVALID MONTH</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="substring($date, 1, 4)" />
</xsl:template>
<xsl:template name="otrfmt">
<xsl:choose>
<xsl:when test="docformat='PDF'">
<xsl:element name="a">
<xsl:attribute name="href">http://www.adobe.com/products/acrobat/readstep2.html</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">images/pdf_ico.jpg</xsl:attribute>
<xsl:attribute name="title">Click here to download/install Adobe PDF Reader</xsl:attribute>
<xsl:attribute name="alt">Click here to download/install Adobe PDF Reader</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='DOC'">
<xsl:element name="a">
<xsl:attribute name="href">http://www.microsoft.com/downloads/details.aspx?FamilyID=3657ce88-7cfa-457a-9aec-f4f827f20cac&DisplayLang=en</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">images/word_ico.jpg</xsl:attribute>
<xsl:attribute name="title">Click here to download/install MS Word Reader</xsl:attribute>
<xsl:attribute name="alt">Click here to download/install MS Word Reader</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='XLS'">
<xsl:element name="a">
<xsl:attribute name="href">http://www.microsoft.com/downloads/details.aspx?FamilyID=1cd6acf9-ce06-4e1c-8dcf-f33f669dbc3a&DisplayLang=en</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">images/xls_ico.jpg</xsl:attribute>
<xsl:attribute name="title">Click here to download/install MS Excel Reader</xsl:attribute>
<xsl:attribute name="alt">Click here to download/install MS Excel Reader</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='ZIP'">
<xsl:element name="a">
<xsl:attribute name="href">http://www.winzip.com/downwz.htm</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">images/zip_ico.jpg</xsl:attribute>
<xsl:attribute name="title">Click here to download/install WinZip</xsl:attribute>
<xsl:attribute name="alt">Click here to download/install WinZip</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='PPT'">
<xsl:element name="a">
<xsl:attribute name="href">http://www.microsoft.com/downloads/details.aspx?FamilyID=048dc840-14e1-467d-8dca-19d2a8fd7485&DisplayLang=en</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">images/ppt_ico.jpg</xsl:attribute>
<xsl:attribute name="title">Click here to install MS Powerpoint Reader</xsl:attribute>
<xsl:attribute name="alt">Click here to install MS Powerpoint Reader</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='JPG'">
<xsl:element name="img">
<xsl:attribute name="src">images/jpg_ico.jpg</xsl:attribute>
<xsl:attribute name="alt"></xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='MPG'">
<xsl:element name="img">
<xsl:attribute name="src">images/mpg_ico.jpg</xsl:attribute>
<xsl:attribute name="title">This is a MPEG/MPG multimedia file</xsl:attribute>
<xsl:attribute name="alt">This is a MPEG/MPG multimedia file</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='WMV'">
<xsl:element name="img">
<xsl:attribute name="src">images/wmv_ico.jpg</xsl:attribute>
<xsl:attribute name="title">This is a WMV multimedia file</xsl:attribute>
<xsl:attribute name="alt">This is a WMV multimedia file</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='TXT'">
<xsl:element name="img">
<xsl:attribute name="src">images/txt2_ico.jpg</xsl:attribute>
<xsl:attribute name="title">This is a Plain Text Format file</xsl:attribute>
<xsl:attribute name="alt">This is a Plain Text Format file</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='RTF'">
<xsl:element name="img">
<xsl:attribute name="src">images/txt_ico.jpg</xsl:attribute>
<xsl:attribute name="title">This is a Rich Text Format file</xsl:attribute>
<xsl:attribute name="alt">This is a Rich Text Format file</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="docformat='MDB'">
<xsl:element name="img">
<xsl:attribute name="src">images/mdb_ico.jpg</xsl:attribute>
<xsl:attribute name="title">This is a MS Access Database</xsl:attribute>
<xsl:attribute name="alt">This is a MS Access Database</xsl:attribute>
<xsl:attribute name="class">dwnldimg</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
|
|

May 15th, 2009, 02:16 PM
|
|
Authorized User
|
|
Join Date: Oct 2008
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Thanks for your patience and kind help, Martin. I copied your code into my stylesheet.
Unfortunately, I've still got the same output. They all show on one page, nothing on the other. The other meeting dates display correctly on their appropriate pages, but for the 20090219 & 20090416 dates it's all or nothing. I've double checked the XML to make sure that the project indicators are where they should be (i.e. <program id="rtcc">), and they are correct. If I change '20090416' to '20090616' or '20090417', it works correctly. Is it something in the way that the dates index?
|
|

May 16th, 2009, 07:25 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
|
|
When I use the stylesheet posted in Quick workaround for sort, group by program & date? to transform the XML sample
Code:
<downloads>
<item category="agenda">
<program id="rtcc">RTCC</program>
<docdate>20090219</docdate>
<title>agenda</title>
<desc>meeting agenda</desc>
<xref>ftp://ftp.tjcog.org/pub/tarpo/agendas/agd20090219_rtcc.pdf</xref>
<docformat>PDF</docformat>
<docsize>
<mb></mb>
<kb>91</kb>
</docsize>
<comment></comment>
<postdate>20090219</postdate>
</item>
<item category="summary">
<program id="rtcc">RTCC</program>
<docdate>20090219</docdate>
<title>summary</title>
<desc>meeting summary</desc>
<xref>ftp://ftp.tjcog.org/pub/tarpo/minutes/mm20090219_rtcc.pdf</xref>
<docformat>PDF</docformat>
<docsize>
<mb></mb>
<kb>91</kb>
</docsize>
<comment></comment>
<postdate>20090219</postdate>
</item>
<item category="meeting">
<program id="rtcc">RTCC</program>
<docdate>20090219</docdate>
<title>Item 4.1 - TARPO RTAC Resolution - Pittsboro 2009 CMAQ Project</title>
<desc>Item 4.1 - TARPO RTAC Resolution - Pittsboro 2009 CMAQ Project</desc>
<xref>ftp://ftp.tjcog.org/pub/tarpo/mtgmat/rtcc20090219_item4_1.pdf</xref>
<docformat>PDF</docformat>
<docsize>
<mb></mb>
<kb>91</kb>
</docsize>
<comment></comment>
<postdate>20090219</postdate>
</item>
<item category="agenda">
<program id="rtac">RTAC</program>
<docdate>20090219</docdate>
<title>agenda</title>
<desc>meeting agenda</desc>
<xref>ftp://ftp.tjcog.org/pub/tarpo/agendas/agd20090219.pdf</xref>
<docformat>PDF</docformat>
<docsize>
<mb></mb>
<kb>91</kb>
</docsize>
<comment></comment>
<postdate>20090219</postdate>
</item>
<item category="summary">
<program id="rtac">RTAC</program>
<docdate>20090219</docdate>
<title>summary</title>
<desc>meeting summary</desc>
<xref>ftp://ftp.tjcog.org/pub/tarpo/minutes/mm20090219.pdf</xref>
<docformat>PDF</docformat>
<docsize>
<mb></mb>
<kb>91</kb>
</docsize>
<comment></comment>
<postdate>20090219</postdate>
</item>
<item category="meeting">
<program id="rtac">RTAC</program>
<docdate>20090219</docdate>
<title>Item 5.1.1 - TARPO RTAC Resolution - Pittsboro 2009 CMAQ Project 2-19-09</title>
<desc>Item 5.1.1 - TARPO RTAC Resolution - Pittsboro 2009 CMAQ Project 2-19-09</desc>
<xref>ftp://ftp.tjcog.org/pub/tarpo/mtgmat/rtac20090219_item5_1_1.pdf</xref>
<docformat>PDF</docformat>
<docsize>
<mb></mb>
<kb>91</kb>
</docsize>
<comment></comment>
<postdate>20090219</postdate>
</item>
</downloads>
setting the parameter project=rtac, then I get the following output (tested with Saxon 6.5.5):
Code:
<h3 class="sidebar">Meeting Information</h3>
<p style="margin: -8px 0 0 0; font-size: .8em; font-style: italic; color: #887">
(click on date to view documents)
</p><a style="font-weight: bold" href="javascript:toggleDiv('20090219')">
<h4>19February2009</h4></a><div style="display:none; margin-bottom: 10px" id="20090219">
<table>
<tr style="background-color: #fff; border: 0;">
<td style="padding: 3px"><a href="ftp://ftp.tjcog.org/pub/tarpo/agendas/agd20090219.pdf">agenda</a><a href="http://www.adobe.com/products/acrobat/readstep2.html"><img src="images/pdf_ico.jpg" title="Click here to download/install Adobe PDF Reader" alt="Click here to download/install Adobe PDF Reader" class="dwnldimg"></a></td>
</tr>
<tr style="background-color: #ede5df; border: 0;">
<td style="padding: 3px"><a href="ftp://ftp.tjcog.org/pub/tarpo/minutes/mm20090219.pdf">summary</a><a href="http://www.adobe.com/products/acrobat/readstep2.html"><img src="images/pdf_ico.jpg" title="Click here to download/install Adobe PDF Reader" alt="Click here to download/install Adobe PDF Reader" class="dwnldimg"></a></td>
</tr>
<tr style="background-color: #fff; border: 0;">
<td style="padding: 3px"><a href="ftp://ftp.tjcog.org/pub/tarpo/mtgmat/rtac20090219_item5_1_1.pdf">Item 5.1.1 - TARPO RTAC Resolution - Pittsboro 2009 CMAQ Project 2-19-09</a><a href="http://www.adobe.com/products/acrobat/readstep2.html"><img src="images/pdf_ico.jpg" title="Click here to download/install Adobe PDF Reader" alt="Click here to download/install Adobe PDF Reader" class="dwnldimg"></a></td>
</tr>
</table>
</div>
If that is still not what you want then please explain what kind of result you want instead.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
|
|

May 18th, 2009, 10:39 AM
|
|
Authorized User
|
|
Join Date: Oct 2008
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
No, that's exactly what I wanted. Unfortunately, it's not working that way on our host (nor locally) and I don't understand why. I literally copied and pasted your code into the stylesheet. I'm completely stumped as to why it's working for you and not for me.
|
|

May 18th, 2009, 11:47 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
|
|
Which XSLT processor do you use? How exactly do you run the transformation? If you need help to find out why your local attempts don't work as intended then you need to provide enough information enabling us to reproduce the problem.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
|
|

May 18th, 2009, 01:50 PM
|
|
Authorized User
|
|
Join Date: Oct 2008
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
My mistake, Martin. I got it to work. I had left out one thing in my paste attempt.  Thanks so very much for hanging in there with me. It works great and solves the problem. A virtual bottle of champagne to you!
Thanks to everyone who tried to help with this too.
|
|
 |