[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

AW: Strange Sorting Problem

Subject: AW: Strange Sorting Problem
From: Iris Benjamin <Benjamin.Iris@xxxxxxxxxxxxxxx>
Date: Wed, 3 Dec 2003 16:56:24 +0100
iris benjamin
Hi

I have an XML file :
_____________________________
<?xml-stylesheet type="text/xsl" href="testSummaryTransform.xslt"?>
<testSummary>
  <testCase name="UCTS211_3_3.xml" iteration="C8" success="1"  />
  <testCase name="UCTS211_3_2_5_1.xml" iteration="C8" success="0" />
  <testCase name="UCTS211_3_2_5_2.xml" iteration="C8" success="0"  />
</testSummary>
________________________________________________
In my .XSLT file, I would like to Display :
- the number of test cases, here I expect 3
- the number of test cases with success=1
- the number of test cases with success=0

I know I should use the function count() for the first request, but I don't
know how:
<td align="center">Number of Test Cases:???????</td>

I would be pleased if you could tell me what to write instead of ??????

Thanks




-----Ursprüngliche Nachricht-----
Von: CBeach@xxxxxxxxxxxx [mailto:CBeach@xxxxxxxxxxxx]
Gesendet: Mittwoch, 3. Dezember 2003 16:28
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: Re:  Strange Sorting Problem


thanks for the help, declaring
 <xsl:with-param name="sorted_field">
has enabled the xsl to run and i can debug it and see the sortfield
value, which is correct. but it still does not sort as it should...

> I am not sure what you want to do here but you are selecting all the
> descendent elements of workitem, but in your sample, all te hworkitem
> elements had no descendent elements, they all just had a single text
> node child containing a number, so you ares orting an empty list.

my xml and corresponding xsl are structured as
<staffware>
      <workitems>
for each
            <department>
call workitem template
                  <workitem>
                  </workitem>
            </department>
next
      </workitems>
</staffware>

so, am i not select the descendent elements of the department element?
it works fine but so far, even with your help, the sorting issue
remains.

> <nobr>
> is not html (not that XSLT cares whether the html you generate is
valid
> or not)

i know :)
                                                                         
                                                                         
                                                                         
 Regards                                                                 
                                                                         
                                                                         
                                                                         
 Christopher Beach MCP                                                   
                                                                         
 Senior Software Developer                                               
                                                                         
 Assistant Treasurer                                                     
                                                                         
                                                                         
                                                                         
 The Bank of New York Europe Limited                                     
                                                                         
 Direct: +44 (0)20 7964 5344                                             
                                                                         
 Switch: +44 (0)20 7512 3784                                             
                                                                         
 Email: cbeach@xxxxxxxxxxxx                                              
                                                                         
 Web: www.bankofny.com                                                   
                                                                         





|---------+------------------------------------->
|         |           David Carlisle            |
|         |           <davidc@xxxxxxxxx>        |
|         |           Sent by:                  |
|         |           owner-xsl-list@xxxxxxxxxxx|
|         |           rrytech.com               |
|         |                                     |
|         |                                     |
|         |           03/12/03 14:58            |
|         |           Please respond to xsl-list|
|         |                                     |
|---------+------------------------------------->
 
>---------------------------------------------------------------------------
-----------------------------------------------------------------|
  |
|
  |       To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
|
  |       cc:
|
  |       Subject:  Re:  Strange Sorting Problem
|
 
>---------------------------------------------------------------------------
-----------------------------------------------------------------|





a refugee from xml-dev:-)

  will append the xml and xslt inline. sorry for the bucket load of code
  but thought it best! ;)

er well complete input and output is always good, but i think you could
easily have deleted 90% of the stylesheet for the purposes of
demonstrating the problem.

as explained on xml-dev

 <xsl:sort select='$sorted_field'

is a constant sort key so does not sort anything, you would want

 <xsl:sort select='*[name()=$sorted_field'

but.. you say

> but whilst the variable i am using to implement the sort is populated

I'm not sure what you mean by populated, but it's out of scope, the
scope of a variable or parameter is the element containing the variable
declaration.

In your case it is clearthat this template has no declaration for a
variable called sorted_field'
      <xsl:template name="workitem">
            <xsl:for-each select="descendant::*">

                  <xsl:sort select='$sorted_field'

You have

 <xsl:with-param name="sorted_field"

but you also need to declare the parameter of the template in the
template itself (unless it is a global param)

so  <xsl:template name="workitem">
     <xsl:param name="sorted_field"/>
            <xsl:for-each select="descendant::*">


I am not sure what you want to do here but you are selecting all the
descendent elements of workitem, but in your sample, all te hworkitem
elements had no descendent elements, they all just had a single text
node child containing a number, so you ares orting an empty list.



other unrelated things

  <img src='..\Images\asc.gif'>

is not a URI, URIs always use / not \

 <nobr>
is not html (not that XSLT cares whether the html you generate is valid
or not)

David



--
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list







________________________________________________________________________
The information in this e-mail, and any attachment therein, is confidential
and for use by the addressee only. If you are not the intended recipient,
please return the e-mail to the sender and delete it from your computer.
Although The Bank of New York attempts to sweep e-mail and attachments for
viruses, it does not guarantee that either are virus-free and accepts no
liability for any damage sustained as a result of viruses.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.