【发布时间】:2011-08-13 02:12:43
【问题描述】:
我试图做的是显示一个 XML 文件中所有博客文章的列表,该文件包含所有博客文章标题的列表及其发布日期。我正在寻找的输出类型是:
HTML 输出:
<ul>
<h3>February 2011</h3>
<li>Blog Title - 09/02/2011</li>
<li>1 More Blog Title - 19/02/2011</li>
<h3>March 2011</h3>
<li>More Blogging - 15/03/2011</li>
<h3>April 2011</h3>
<li>Another Title - 29/04/2011</li>
</ul>
来自以下 XMLL
XML:
<BlogPosts>
<Post>
<Title>Blog Title</Title>
<CreatedBy>A Another</CreatedBy>
<PublishedDate>09/02/2011</PublishedDate>
<Url>Http://url.com</Url>
<BlogBody>Some text here...<BlogBody>
</Post>
<Post>
<Title>1 More Blog Title</Title>
<CreatedBy>A Another</CreatedBy>
<PublishedDate>19/02/2011</PublishedDate>
<Url>Http://url.com</Url>
<BlogBody>Some text here...<BlogBody>
</Post>
<Post>
<Title>More Blogging</Title>
<CreatedBy>A Another</CreatedBy>
<PublishedDate>15/03/2011</PublishedDate>
<Url>Http://url.com</Url>
<BlogBody>Some text here...<BlogBody>
</Post>
<Post>
<Title>Another Title</Title>
<CreatedBy>A Another</CreatedBy>
<PublishedDate>29/04/2011</PublishedDate>
<Url>Http://url.com</Url>
<BlogBody>Some text here...<BlogBody>
</Post>
</BlogPosts>
有没有一种方法可以按日期对博客帖子进行分组,并使用 XSLT 输出它们所在月份的名称?
【问题讨论】: