I am new to XSL and working a bit above my head.
I have an xml file (show below) which I wanted to group by month&year. I achieved this with Muenchian Grouping... however that led to a new issue around nested for-each statements.
The issue is that all links are now only pointing to the first link in the array, rather than their own.
Below my XML is the XSL which has two body statements separated by ///
The first is my logic with the grouping, and incorrect linking. The lower one, which is initially commented out, was my statement before the grouping which has correctly functioning links.
If somebody could please help me to restructure my logic it would be very very appreciated. I'm so close to finishing!
XML:
<?xml version="1.0" encoding="UTF-8"?>
-<rss version="2.0">-
<channel>
<title>Company Name</title>
<description>Company News and Events</description>
<link>http://brattle.com/</link>
<item>
<title>Paul Hinton and Pavitra Kumar to Speak at High-Frequency Trading Litigation Webinar</title>
<description><p>Brattle principal Paul Hinton and senior associate Pavitra Kumar will present in the upcoming webinar, “High-Frequency Trading Litigation in 2015,” hosted by The Knowledge Group on March 26, 2015 from 3:00 pm – 5:00 pm EST.</p><p>This webcast will discuss issues surrounding High-Frequency Trading (HFT), which in recent years has increased and become a focus of regulators. The Joint Commodity Futures Trading Commission (CFTC)-Securities and Exchange Commission (SEC) Advisory Committee has expressed concern over the volume of orders and cancellations of trades (spoofing), and the SEC, CFTC, and the FBI have all announced investigations of HFT practices. Panelists will address how HFT will continue to create challenging analytical and legal issues involving its complexity and multi-party nature of trading, changing regulation, and new legal theories.</p><p>Dr. Kumar will speak on the “Key Areas of High-Frequency-Trading-Related Litigation and Related Economic Issues,” including exchange-related litigation, litigation against HFT firms, and market access litigation. Mr. Hinton will speak on the latest issues surrounding HFT litigation in light of the continued scrutiny by regulators placed on financial firms.</p><p>For more information on the webinar, or to register, please visit the <a href="http://theknowledgegroup.org/event_name/high-frequency-trading-litigation-in-2015-explored-live-webcast/">website</a>.</p></description>
<pubDate>26 Mar 2015</pubDate>
<link>http://brattle.com/news-and-knowledge/events/813</link>
<guid>http://brattle.com/news-and-knowledge/events/813</guid>
</item>
<item>
<title>Bruce Tsuchida to Present at Upcoming LSI Conference on Transmission in the Northeast</title>
<description><p>Brattle principal Bruce Tsuchida has been selected to present at the upcoming Law Seminars International (LSI) conference, “Transmission in the Northeast: Legal, Business and Regulatory Developments,” taking place March 19-20, 2015 in Boston, MA.</p><p>Participants in this event will include attorneys, industry executives, government officials, and customer representatives involved with electric generation and transmission. The conference will examine the issues surrounding transmission and distributed system technology and policy, along with the regulatory changes that are affecting expansion, coordination, and planning efforts.</p><p>Mr. Tsuchida will participate in the panel session, “How Greater Reliance on Distributed Resources Affects Distribution and Transmission.”</p><p>To learn more about the event, or to register, visit the LSI <a href="http://www.lawseminars.com/detail.php?SeminarCode=15ETRANMA">website</a>.</p></description>
<pubDate>19 Mar 2015</pubDate>
<link>http://brattle.com/news-and-knowledge/events/814</link>
<guid>http://brattle.com/news-and-knowledge/events/814</guid>
</item>
<item>
<title>Deploying Up to 5,000 MW of Grid-Integrated Electricity Storage in Texas Could Provide Substantial Net Benefits According to Brattle Economists</title>
<description><p>A report recently released by Brattle economists finds that the deployment of grid-integrated distributed electricity storage in Texas could provide substantial net benefits to the power system in ERCOT and its electricity customers. The report, commissioned by Oncor Electric Delivery Company, a Transmission and Distribution Service Provider (TDSP) in Texas, evaluates whether storage could be cost-effectively deployed from the perspectives of retail customers, wholesale electricity market participants, and the combined system or “society as a whole” while maintaining wholesale power prices that continue to support necessary generation investments. The recently released report is a follow-up to preliminary results released in November 2014.</p><p>The Brattle report estimates that 3,000 to 5,000 MW of grid-integrated, distributed electricity storage would be the most cost-effective from an ERCOT system-wide societal perspective based on a forecast of installed cost of storage of approximately $350/kWh. The authors identify four components of storage value from a system-wide perspective to estimate net benefits, including avoided distribution outages, deferred transmission and distribution (T&D) investment, avoided new generation or demand-side capacity investments, and electricity production cost savings. From an electricity customer’s perspective, deploying storage across ERCOT would decrease customer bills slightly and additionally provide significant reliability benefits in the form of reduced power outages for customers located in areas where storage is installed.</p><p>“Considering both the impact on electricity bills and improved reliability of grid-integrated storage, the customer benefits would significantly exceed costs,” said Judy Chang, a Brattle principal and lead author of the study. “However, while beneficial from an integrated, system-wide perspective, an efficient scale of storage deployment would not be reached if deployed by merchant developers who rely solely on participation in the wholesale market, or by retail customers who use it solely for back-up power, or by wires companies who deploy it solely for capturing T&D benefits. These entities, independently and separately, will not be able to capture the full value of the storage to viably support the magnitude of investment that could be cost-effective for ERCOT.”</p><p>The authors show that enabling cost-effective investments in electricity storage will require a regulatory framework that helps investors capture the combined values of storage from the wholesale market, the T&D systems, and customer outage reduction. Thus, the authors recommend a regulatory framework that would involve allowing the transmission and distribution companies to deploy the electricity storage on the distribution system and “auction off” to independent third parties the rights to use the storage facilities for participation in the wholesale market.</p><p>“The Value of Distributed Electricity Storage in Texas: Proposed Policy for Enabling Grid-Integrated Storage Investments,” is authored by Ms. Chang, Johannes Pfeifenberger, Kathleen Spees, and Matthew Davis, with the support of Brattle research analysts. It is available for download below.</p></description><pubDate>13 Mar 2015</pubDate>
<link>http://brattle.com/news-and-knowledge/news/808</link>
<guid>http://brattle.com/news-and-knowledge/news/808</guid>
</item>
</channel>
</rss>
XSL:
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
version="1.0" exclude-result-prefixes="xsl ddwrt msxsl rssaggwrt"
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
xmlns:rssaggwrt="http://schemas.microsoft.com/WebParts/v3/rssagg/runtime"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:rssFeed="urn:schemas-microsoft-com:sharepoint:RSSAggregatorWebPart">
<xsl:param name="rss_FeedLimit">30</xsl:param>
<xsl:param name="rss_ExpandFeed">true</xsl:param>
<xsl:param name="rss_LCID">1033</xsl:param>
<xsl:param name="rss_WebPartID">RSS_Viewer_WebPart</xsl:param>
<xsl:param name="rss_alignValue">left</xsl:param>
<xsl:param name="rss_IsDesignMode">True</xsl:param>
<!--////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////-->
<xsl:key name="item-pubDate" match="item" use="substring(pubDate,3,9)" />
<xsl:template match="channel">
<xsl:variable name="Rows" select="channel/item"/>
<xsl:variable name="RowCount" select="count($Rows)"/>
<xsl:variable name="item_link" select="item/link"/>
<xsl:variable name="item_title" select="description"/>
<xsl:for-each select="$Rows"/>
<xsl:variable name="CurPosition" select="position()" />
<xsl:variable name="PrevPosition" select="position()-1" />
<xsl:variable name="RssFeedLink" select="$rss_WebPartID" />
<xsl:variable name="CurrentElement" select="concat($RssFeedLink,$CurPosition)" />
<xsl:for-each select ="item[count(. | key('item-pubDate', substring(pubDate,3,9))[1]) = 1]">
<div align="center">
<hr/>
<xsl:value-of select="substring(pubDate,3,9)" />
</div>
<xsl:for-each select="key('item-pubDate', substring(pubDate,3,9))">
<!--<xsl:sort select="pubDate" order="descending"/>-->
<li>
<xsl:for-each select="$Rows"/>
<a href="{$item_link}" title="{$item_title}">
<xsl:variable name="SafeHtml">
<xsl:call-template name="GetSafeHtml">
<xsl:with-param name="Html" select="title"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
</a>
<!--</xsl:for-each>-->
</li>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<!--////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////-->
<!--<xsl:template match="item">
<xsl:variable name="Rows" select="channel/item"/>
<xsl:variable name="RowCount" select="count($Rows)"/>
<xsl:variable name="item_link" select="link"/>
<xsl:variable name="item_title" select="description"/>
<xsl:for-each select="$Rows"/>
<xsl:variable name="CurPosition" select="position()" />
<xsl:variable name="PrevPosition" select="position()-1" />
<xsl:variable name="RssFeedLink" select="$rss_WebPartID" />
<xsl:variable name="CurrentElement" select="concat($RssFeedLink,$CurPosition)" />
<xsl:if test="not(substring(pubDate,3,9) = 0)">
<div align="center">
<hr/>
<xsl:value-of select="substring(pubDate,3,9)" disable-output-escaping="yes"/>
</div>
</xsl:if>
<li>
<a href="{$item_link}" title="{$item_title}">
<xsl:variable name="SafeHtml">
<xsl:call-template name="GetSafeHtml">
<xsl:with-param name="Html" select="title"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
</a>
</li>
</xsl:template>-->
<!--////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////-->
<xsl:template name="GetSafeHtml">
<xsl:param name="Html"/>
<xsl:choose>
<xsl:when test="$rss_IsDesignMode = 'True'">
<xsl:value-of select="$Html"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="rssaggwrt:MakeSafe($Html)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Due to the nature of this request, I left the urls etc in tact. I'm trusting you, internet.
haha, any help very appreciated, i'll keep fiddling with my nesting in the meantime