XSL transformation

Posted on 2011-05-02
Last Modified: 2012-05-11
Hi Guys,

First off, thank you for taking the time to read my question!!

I have the following XSLT sample:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
      <xsl:template match="/">
            <xsl:variable name="scope" select="/clientdemo/transaction[account = 16 and tr_payment_date &gt; 20091231 and tr_payment_date &lt;= 20100131]"/>
            <xsl:value-of select="sum($scope/tr_to_agency) + sum($scope/tr_to_client)"/>

that goes off the following example data:


The XSLT sample works perfectly but what I want to do is this:

On The page where this XSLT goes, there is another XSLT section up the top.  If I click on one of the individual records it also sends through a variable called accountclientrowid.  What I want to happen, is IF it is clicked, the XSLT still works the same but it filters the data so that only the rows that have a clientrowid=accountclientrowid are added.

could someone please give me example of how this would work?

many thanks!!!
Question by:mavmanau
    LVL 60

    Accepted Solution

    Just assuming you have the server side ready

    You likely have a parameter set in the request header when pushing the button (the accountclientrow)
    Pass this parameter to the XSLT when you call it

    In the XSLT get that parameter and do a test:
    I assume it would be empty when you don't pass it
    <xsl:stylesheet version="1.0" xmlns:xsl="">
        <xsl:param name="accountclientrowid"/>
        <xsl:template match="/">
            <xsl:variable name="scope" select="/clientdemo/transaction[account = 16 and tr_payment_date &gt; 20091231 and tr_payment_date &lt;= 20100131]"/>
                <xsl:when test="$accountclientrowid > 0">
                    <xsl:value-of select="sum($scope[$accountclientrowid = Client_row_id]/tr_to_agency) + sum($scope[$accountclientrowid = Client_row_id]/tr_to_client)"/>
                    <xsl:value-of select="sum($scope/tr_to_agency) + sum($scope/tr_to_client)"/>

    Open in new window


    Author Closing Comment

    sweet...thank is giving me a few issues but i should be able to work through them.

    Thank you very much!!
    LVL 60

    Expert Comment

    by:Geert Bormans

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Suggested Solutions

    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now