Click here to Skip to main content
15,888,802 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: XML and performance Pin
Gerald Schwab15-Oct-08 16:57
Gerald Schwab15-Oct-08 16:57 
GeneralRe: XML and performance Pin
pedefetoll17-Oct-08 6:54
pedefetoll17-Oct-08 6:54 
QuestionXPath Predicates Pin
threemp37-Oct-08 12:11
threemp37-Oct-08 12:11 
AnswerRe: XPath Predicates Pin
threemp37-Oct-08 12:15
threemp37-Oct-08 12:15 
GeneralRe: XPath Predicates Pin
threemp37-Oct-08 12:32
threemp37-Oct-08 12:32 
GeneralRe: XPath Predicates Pin
led mike8-Oct-08 4:50
led mike8-Oct-08 4:50 
Questionattribute dependand element? Pin
jVersteegen7-Oct-08 1:32
jVersteegen7-Oct-08 1:32 
QuestionHow to use XSL to get the most common value in XML Pin
darasd1-Oct-08 0:17
darasd1-Oct-08 0:17 
Hello. How can I use XSL to get the most common value of a given attribute in some unsorted XML? For instance, here is some XML:
<fixtures>
<fixture time="1930" date="20080926"></fixture>
<fixture time="0930" date="20080927"></fixture>
<fixture time="0930" date="20080927"></fixture>
<fixture time="1000" date="20080928"></fixture>
<fixture time="1000" date="20080926"></fixture>
<fixture time="0930" date="20080926"></fixture>
<fixture time="1230" date="20080930"></fixture>
</fixtures>

I would like to end up with <xsl:value-of select="$mostCommonTime" xmlns:xsl="#unknown"></xsl:value-of>, therefore producing an output of "0930" - the most common value of the time attribute.

Just to complicate things, I need to do further validation on each fixture (using the date attribute), to see whether it is counted or not. This validation is done using Javascript, since it involves date functions, and we are using (and due to 3rd party restrictions, can only use) XSL 1.0. So, each fixture needs to be examined in a separate template, rather like this: <xsl:value-of select="lxslt:isFixtureValid(string(Fixture/@date))" xmlns:xsl="#unknown"></xsl:value-of>, and is discounted or counted depending on whether this output is 'true' or 'false'.

I've tried a recursive template, but do not see a way of sorting the Fixtures node that has to be passed into it; if I try a for-each loop, there is no way of keeping track of the most common time.

Thanks.
AnswerRe: How to use XSL to get the most common value in XML Pin
led mike1-Oct-08 5:06
led mike1-Oct-08 5:06 
GeneralRe: How to use XSL to get the most common value in XML Pin
darasd1-Oct-08 5:30
darasd1-Oct-08 5:30 
GeneralRe: How to use XSL to get the most common value in XML Pin
led mike1-Oct-08 6:42
led mike1-Oct-08 6:42 
GeneralRe: How to use XSL to get the most common value in XML Pin
darasd1-Oct-08 22:34
darasd1-Oct-08 22:34 
GeneralRe: How to use XSL to get the most common value in XML Pin
led mike2-Oct-08 4:32
led mike2-Oct-08 4:32 
AnswerRe: How to use XSL to get the most common value in XML [modified] Pin
Gerald Schwab15-Oct-08 17:25
Gerald Schwab15-Oct-08 17:25 
QuestionXML+XLST simple simple question Pin
Herds30-Sep-08 20:16
Herds30-Sep-08 20:16 
AnswerRe: XML+XLST simple simple question Pin
led mike1-Oct-08 4:57
led mike1-Oct-08 4:57 
GeneralRe: XML+XLST simple simple question Pin
Herds1-Oct-08 7:30
Herds1-Oct-08 7:30 
QuestionHow to catch an exception thrown by MSXML? [modified] Pin
JoeSchmoe00730-Sep-08 7:42
JoeSchmoe00730-Sep-08 7:42 
AnswerRe: How to catch an exception thrown by MSXML? Pin
led mike1-Oct-08 5:03
led mike1-Oct-08 5:03 
QuestionXDS Pin
postonoh29-Sep-08 11:36
postonoh29-Sep-08 11:36 
AnswerRe: XDS Pin
Dave Kreskowiak29-Sep-08 11:59
mveDave Kreskowiak29-Sep-08 11:59 
GeneralRe: XDS Pin
postonoh29-Sep-08 13:53
postonoh29-Sep-08 13:53 
Questionapply xsl on xml to generate sql Pin
AndieDu28-Sep-08 13:51
AndieDu28-Sep-08 13:51 
AnswerRe: apply xsl on xml to generate sql Pin
AndieDu28-Sep-08 19:06
AndieDu28-Sep-08 19:06 
QuestionHow do I create a schema for elements with attributes Pin
Christian Wikander26-Sep-08 3:50
Christian Wikander26-Sep-08 3:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.