I am new to xslt,i tried to get the distinct years and the corresponding number of publications
for eg
YearNumber of publication
2008 6
2009 4
I am using Xpath 1.0
I managed to get the date value changed to the above format but then to count the number of publication it makes my mind to blow
The Xslt which converts the date
$
Thankyou guys,i think Xslt key is an interesting logic to solve the problem,even though i couldn't manage it till now. I spend hours but ,it makes me crazy.
Tommy ,can you please post some solution specific to my problem please?
I am now having two things
1. Get the distinct values
2.Count the number of occurrences of the year only like
I did it like this:- My next step is to draw a java script chart which shows the number of publication as Bars and X axis will be years, if you recommend me some thing it will be excellent.
XSLT count distinct values
I am new to xslt,i tried to get the distinct years and the corresponding number of publications
for eg
Year Number of publication
2008 6
2009 4
I am using Xpath 1.0
I managed to get the date value changed to the above format but then to count the number of publication it makes my mind to blow
The Xslt which converts the date
$
This is my Xml file
Thankyou for your help.
Take a look at this blogpost:
http://www.bernzilla.com/item.php?id=333
The xsl:key element is what you need to dig into.
Or you could look at this simple Umbraco sample:
http://blackpoint.dk/umbraco-workbench.aspx?Snippet=/umbraco-workbench/xslt/grouping--distinct-values.aspx
Thankyou guys,i think Xslt key is an interesting logic to solve the problem,even though i couldn't manage it till now. I spend hours but ,it makes me crazy.
Tommy ,can you please post some solution specific to my problem please?
I am now having two things
1. Get the distinct values
2.Count the number of occurrences of the year only like
2008 6 occurrences
2009 4
Thanks in advance
Thank you Tommy and Århus
I did it with 2 methods
1. By Substring method http://bytes.com/groups/xml/86180-tip-finding-counting-unique-nodes-xsl
2. Key and id
Both are interesting solutions .
My complete xslt. Note that I am using ns0 prefixes to satisfy the namespace on the root node.
[code]
<>
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:ns0="http://www.loc.gov/mods/v3"
exclude-result-prefixes="msxsl ns0">
[/code]
Thankyou Århus,that is excellent.
I did it like this:- My next step is to draw a java script chart which shows the number of publication as Bars and X axis will be years, if you recommend me some thing it will be excellent.
version='1.0'>
Year
Count of Publication
is working on a reply...