Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Jun 2009
    Thanked 0 Times in 0 Posts

    Newbie: XSLT Question - Xsl:if and xsl:for-each-group

    Hello All,

    I'm new to XSLT and XML, so please excuse the basic question. I'm trying to apply a number of conditional xsl:if statements to xsl:for-each-group, but it does not filter out the results. I'm assuming this is because the xsl:for-each-group is defining my group and not allowing the ifs to break it apart?

    Here's a sample of my XML, there are about 1200 entries of Student's, so here's one:
    <Student Id="100000" ProgramType="Freshman FX" AdmitTerm="N/A">
    <Degree>Bachelor of Arts</Degree>
    <Major>Business, Marketing</Major>
    <TotCredits UG="2" Grad="3" Load="18" TransferCredits="N/A"/>
    <PermAddress State="CA">
    <SAT1 type="N/A">
    <SAT2 type="N/A">
    <Classification>trad undergrad</Classification>

    Here's my XSL that I'm trying to apply:

    <h3>Students by Gender</h3>
    <xsl:for-each-group select="Census/Student" group-by="Gender">
    <xsl:sort select="current-grouping-key()"/>
    <xsl:if test="(Gender='Female') and
    <p>Number of Students Who Are:
    <xsl:value-of select="current-grouping-key()"/>
    </b> is
    <xsl:value-of select="count(current-group())"/>


    My Desired Output will give me the count of all females, who have Tom as an advisor, as grouped by their Gender. Currently, it's not applying any of the "if" statements so it's giving me a result of 852 females, rather than the expected value of 8.
    Last edited by JamesDelaney; 06-26-2009 at 10:25 PM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts