Re: [xsl] Conditional display

Subject: Re: [xsl] Conditional display
From: omprakash.v@xxxxxxxxxxxxx
Date: Tue, 24 May 2005 09:33:16 +0530
Hi,
    The xslt below is what you need:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
 <xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/PlanPerformance">

<xsl:value-of select="'FundId'"/>
<xsl:text>      </xsl:text>
<xsl:value-of select="'FundName'"/>

<xsl:text>
</xsl:text>

<xsl:for-each select=".//FundId">
<xsl:if test="not(. = preceding::FundId[1])">

<xsl:value-of select="."/>
<xsl:text>      </xsl:text>

<xsl:choose>
<xsl:when test="following-sibling::FundRate">

<xsl:value-of select="following-sibling::FundRate/FundName"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="following-sibling::FundName"/>
</xsl:otherwise>
</xsl:choose>

</xsl:if>

<xsl:text>
</xsl:text>

</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

Cheers,
Omprakash.V




                                                                                                                   
                    "Asher,                                                                                        
                    Praful"              To:     <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>                                 
                    <praful.asher        cc:     (bcc: omprakash.v/Polaris)                                        
                    @fmr.com>            Subject:     [xsl] Conditional display                                    
                                                                                                                   
                    05/23/2005                                                                                     
                    08:33 PM                                                                                       
                    Please                                                                                         
                    respond to                                                                                     
                    xsl-list                                                                                       
                                                                                                                   
                                                                                                                   




Hi.
I am new to xsl-fo and had a small doubt as to how my xsl should look if my
input xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<PlanPerformance>
           <FundPerformance>
                     <FundId>1</FundId>
                     <FundName>Fund1</FundName>
                     <FundRate>
                               <FundId>1</FundId>
                               <FundName>FundOne</FundName>
                               <SubFundRate>
                                          <FundId>2</FundId>
                                          <FundName>Fund2</FundName>
                               </SubFundRate>
                               <SubFundRate>
                                          <FundId>3</FundId>
                                          <FundName>Fund3</FundName>
                               </SubFundRate>
                     </FundRate>
           </FundPerformance>
           <FundPerformance>
                     <FundId>2</FundId>
                     <FundName>Fund2</FundName>
           </FundPerformance>
</PlanPerformance>

there can be only 1 FundRate tag within 1 FundPerformance.

I want to have a display like follows on my pdf.

Fund Id   Fund Name
-----------   ----------------
1          FundOne        (Name picked from FundRate as FundRate is
present)
2          Fund2
3          Fund3
           2                 Fund2        (Name picked from FundPerformance
as FundRate is not present)

           Can someone please help me out in this case?

           Thanks,
           Praful.






This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

Current Thread