[xsl] retrive data from #1 xml via data from #2 xml

Subject: [xsl] retrive data from #1 xml via data from #2 xml
From: "Walter Torres" <walter@xxxxxxxxx>
Date: Mon, 12 Mar 2001 22:49:11 -0500
I have 2 xml files.

One is my main data source.

The Second is a display characteristics file. Meaning...
  - the order of the data in the columns of a table
  - the title of each column
  - the width of each column
  - the id of the column to correlate to the NODE in the main data
  - the default sort order of each column
  - etc

 <display id='date'    colWidth='104' sortOrder='D'
 <display id='to_dest' colWidth='060' sortOrder='A'
 <display id='media'   colWidth='060' sortOrder='A'
 <display id='reason'  colWidth='120' sortOrder='A'
 <display id='comment' colWidth='*'   sortOrder='A'

I have code (thanks to Jeni) that lets me retrieve this info and create the
table column headers...

<!-- pull data from display xml structure -->
<xsl:variable name="titles"
              select="document('tableData.xml')/titles/display" />

<!-- create table cell characteristics from this data -->
<xsl:for-each select="$titles">
   <th class='sortMe' onClick='top.sort(this, window)'>
      <!-- item name -->
      <xsl:attribute name='name'><xsl:value-of select="." /></xsl:attribute>
      <!-- item ID -->
      <xsl:attribute name='id'><xsl:value-of select="./@id"
      <!-- item Title -->
      <xsl:attribute name='title'>Sort by <xsl:value-of
      <!-- column width -->
      <xsl:attribute name='width'><xsl:value-of select="./@colWidth"
      <!-- Sort Default -->
      <xsl:attribute name='sortOrder'><xsl:value-of select="./@sortOrder"
      <!-- define Default Sort Direction -->
      <xsl:attribute name='defaultSort'><xsl:value-of
select="./@defaultSort" /></xsl:attribute>
      <!-- Display Title -->
      <xsl:value-of select='.'/>

This create the <TH> tag with all its proper attributes just fine! (Thanks

Now I need to find a way to use this same data to display the main data in
this table structure based upon the order of this secondary data, not the
order that the data is in the primary data file.

    Date   Agent   Channel   Reason   Comments

Below is a sample of my primary data source.

Anyone have any pointers on how to retrieve the proper NODE in this stated
order, or whatever order the secondary xml file says to retrieve it in?



Sample Data

   <interaction id='19766'>
         <media_type id='103'>Phone</media_type>
         <channel id='1'>&lt;unspecified&gt;</channel>
         <call_event id='34757'>
            <call_event_type id='29'>cal</call_event_type>
            <customer id='2145'>John Watson</customer>
            <curr_dest id='103'>Vincent</curr_dest >
            <to_dest id='1'>&lt;unspecified&gt;</to_dest>
            <nav_code id='1'>&lt;unspecified&gt;</nav_code>
            <rule id='1'>&lt;unspecified&gt;</rule>
            <greeting id='1'>&lt;unspecified&gt;</greeting>
            <call_type id='1'>&lt;unspecified&gt;</call_type>
            <ext_call id='1'>&lt;unspecified&gt;</ext_call>
            <old_call_record id='1'>&lt;unspecified&gt;</old_call_record>
            <product id='1'>&lt;unspecified&gt;</product>
            <reason id='198'>Case Resolution</reason>


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

Current Thread