Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 27th, 2006, 05:29 PM
Registered User
 
Join Date: Jun 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help in retrieving values from a loop !

Hi ,

   Need one help with a xslt loop. I've the following xml :

<ns0:PartnerQualifications>
     <ns0:Qualification>
          <ns0:QualificationType>Premier Certified Partner</ns0:QualificationType>
          <ns0:QualificationCode>CERT</ns0:QualificationCode>
     </ns0:Qualification>
     <ns0:Qualification>
          <ns0:QualificationType>Exclusive Partner</ns0:QualificationType>
          <ns0:QualificationCode>CERT</ns0:QualificationCode>
     </ns0:Qualification>
     <ns0:Qualification>
                <ns0:QualificationType>Content Networking Specialization</ns0:QualificationType>
                <ns0:QualificationCode>SPECIAL</ns0:QualificationCode>
     </ns0:Qualification>
     <ns0:Qualification>
                <ns0:QualificationType>Switch Networking</ns0:QualificationType>
                <ns0:QualificationCode>SPECIAL</ns0:QualificationCode>
     </ns0:Qualification>
     <ns0:Qualification>
                 <ns0:QualificationType>ATP - Optical - Metro Transport</ns0:QualificationType>
                 <ns0:QualificationCode>AUTH</ns0:QualificationCode>
     </ns0:Qualification>
     <ns0:Qualification>
                 <ns0:QualificationType>Metro Transport</ns0:QualificationType>
                 <ns0:QualificationCode>AUTH</ns0:QualificationCode>
     </ns0:Qualification>
</ns0:PartnerQualifications>

I need to iterate thru this xml and seperate out the values (comma seperated) based on QualificationCode . So the end result will be like :

Premier Certified Partner,Exclusive Partner --> based on AUTH

Content Networking Specialization, Switch Networking --> based on SPECIAL

ATP - Optical - Metro Transport, Metro Transport --> based on AUTH

What I tried was (for CERT type only):

<tr bgcolor="#FFFFFF">
   <th width="200">Partner/Reseller Certification</th>
    <td class="tablecontent" align="center">
    <xsl:for-each select="ns0:PromotionHeader/ns0:PartnerQualifications/ns0:Qualification/ns0:QualificationType">
    <xsl:if test="ns0:PromotionHeader/ns0:PartnerQualifications/ns0:Qualification/ns0:QualificationCode = 'CERT'">
        <xsl:value-of select="."/>
            <xsl:if test="position() &lt; last()">,</xsl:if>
        </xsl:if>
    </xsl:for-each>
    </td>
</tr>

The if loop is wrong as it needs to be check the value within that particular <ns0:Qualification> .
Any pointer will be highly appreciated.

Thanks,
Shamik






Similar Threads
Thread Thread Starter Forum Replies Last Post
for-each loop and blank values Navy1991_1 XSLT 3 June 6th, 2008 08:24 AM
retrieving comma separated values from column abhishekkashyap27 SQL Server 2005 6 April 21st, 2008 09:27 AM
retrieving values with xsl Tomi XSLT 14 April 5th, 2007 02:07 AM
delay in retrieving values through session mrjoka ASP.NET 2.0 Basics 2 March 14th, 2007 08:02 AM
loop values and text box values move mateenmohd Classic ASP Basics 2 April 5th, 2005 11:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.