This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Concat state-city together


Hi,

  I am having problem figure this out, so any help is
appreciated.
  I have a source document, where a row contain either
state or city names.  State names are always located
at cell/@column=1 and city names are always
cell/@column=2.  I want to concat each of the city
names with the last state name in the previous rows. 
Following is an example:

Source XML:
<row row="17">
	<cell column="1">Alabama</cell>
</row>
<row row="18">
	<cell column="2">Birmingham</cell>
</row>
<row row="19">
	<cell column="2">Hoover</cell>
</row>
<row row="20">
	<cell column="1">Arizona</cell>
</row>
<row row="21">
	<cell column="2">Phoenix</cell>
</row>
<row row="22">
	<cell column="2">Tucson</cell>
</row>
<!-- more states and cities follows -->

Target text:
Alabama-Birmingham
Alabama-Hoover
Arizona-Phoenix
Arizona-Tucson

I thought one way is to first pre-process the source
and get all states, then for-each state process the
cities following it.  But I have problem figure out
the exact apply-templates statement with start/end
row.

Is there a more elegent way to solve this problem,
maybe apply templates recursively?

Any help would be much appreciated.

Thanks,
Xiaocun

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]