[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] New doubt !


Subject: Re: [xsl] New doubt !
From: omprakash.v@xxxxxxxxxxxxx
Date: Tue, 3 May 2005 09:55:49 +0530

Hi,
             This can be done using keys. see below the structure of the
lookup table xml file and the xsl stylesheet.


<lookupEntries>
<name id="BangaloreCentral">2345</name>
<name id="Walmart">2374</name>
</lookupEntries>


XSLT file:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
="1.0">
 <xsl:output method="text"/>

     <xsl:key name="entries" match="name" use="@id"/>
       <xsl:template match="/Chains/RetailStoreID">
          <xsl:variable name="temp" select="."/>
          <xsl:for-each select="document('lookup.xml')">
               <xsl:value-of select="key('entries', $temp)"/>
          </xsl:for-each>

       </xsl:template>
 </xsl:stylesheet>



GL,
Omprakash.V






                                                                                                                     
                    Bharat Shetty                                                                                    
                    <bharat.shetty@        To:     xsl-list@xxxxxxxxxxxxxxxxxxxxxx                                   
                    gmail.com>             cc:     (bcc: omprakash.v/Polaris)                                        
                                           Subject:     [xsl] New doubt !                                            
                    05/03/2005                                                                                       
                    08:29 AM                                                                                         
                    Please respond                                                                                   
                    to xsl-list                                                                                      
                                                                                                                     
                                                                                                                     




Hi all,

I am glad I came across this group.

I need to transform a XML to other structure XML using XSLT.

Fine I have done that quite well according to my projects needs.

Now the problem is ....

When an input element of tag

<RetailStoreID>Bangalore Central</RetailStoreID> is encountered in the
input XML ( Please note that At this stage since this XML is genreated
from some transaction handling code, I will not know in advance what
store will appear in that tag . But eventually all of them are assumed
to be in some lookup table that i will explain now ) , my XSLT should
be able to refer to some other XML that stores in this format

Retail Store Name                      ID
===========================
Bangalore central                  2345
Walmart                               4567

like that ....

I tried using the document("reatilstoreids.xml") what to put in the
query after this is beating me ...

When Walmart is encountered i need to get 4567 and if Bangalore
central i shud get 2345 through some testing so that thats is
displayed in the Output XML . Just help me on how to get ids of the
names encountered in the input XML in this other XML called
RetailerStoreIDs.xml


TIA

--
Bharat






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
Keywords