开发者

XSLT order in months AND years

I have a problem. I have an XML tree which looks similar to this:

<wd:meta>
    <wd:creation time="[TIMESTAMP]" />
    <wd:title><![CDATA[Nice title]]></wd:title>
</wd:meta>

And there are many more siblings with the same Structure. This tree goes into the XSLTProcessor and gets a nice Stylesheet. Now i want to take this apart into months (In my Stylesheet). So that there is something like that:

Everything that happed in August

Nice title 1

Nice title 2

Everything that happend in September

Nice title 3

Nice title 4

How can i do something like this?开发者_如何学C I made a little bit of research but i wasn't very successful. The only thing i found what would be maybe useful was that: following-sibling

Can anyone help me? I really appreciate your help.

Thanks.


edit://

I now used the Muenchian method adopted from http://www.jenitennison.com/xslt/grouping/muenchian.html but i only can order it by month, NOT by year. I tried the Answer of the possible duplicate and tried to understand it, but it's not that easy. Has anyone a easier solution?


In a first step i would iterate your content and generate a monthname for your timestamps. Then you can sort it by the month name. If you have xslt 2.0 you can use group-by to group them by month. If not, you can acturlly iterate your content and check if there is a following-sibling with the current month name. If so, go on with the same month name as the month of the current element. If not, start a new month.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜