xsl-list
[Top] [All Lists]

Re: New doubt !

2005-05-02 21:40:08
Assuming "reatilstoreids.xml" has the form:

<stores>
  <store id="2345">Bangalore central</store>
  <store id="4567">Walmart</store>
</stores>

Then:

<xsl:variable 
  name="store-name"
  select="RetailStoreID"/>

<xsl:value-of 
  select="document('reatilstoreids.xml')/stores/store[descendant-or-self::* = 
$store-name]/@id"/>

Should return the value of "id".


Bharat Shetty <bharat(_dot_)shetty(_at_)gmail(_dot_)com> writes:

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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>