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 <titles> <display id='date' colWidth='104' sortOrder='D' defaultSort='T'>Date</display> <display id='to_dest' colWidth='060' sortOrder='A' defaultSort='F'>Agent</display> <display id='media' colWidth='060' sortOrder='A' defaultSort='F'>Channel</display> <display id='reason' colWidth='120' sortOrder='A' defaultSort='F'>Reason</display> <display id='comment' colWidth='*' sortOrder='A' defaultSort='F'>Comments</display> </titles> 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" /></xsl:attribute> <!-- item Title --> <xsl:attribute name='title'>Sort by <xsl:value-of select='.'/></xsl:attribute> <!-- column width --> <xsl:attribute name='width'><xsl:value-of select="./@colWidth" /></xsl:attribute> <!-- Sort Default --> <xsl:attribute name='sortOrder'><xsl:value-of select="./@sortOrder" /></xsl:attribute> <!-- define Default Sort Direction --> <xsl:attribute name='defaultSort'><xsl:value-of select="./@defaultSort" /></xsl:attribute> <!-- Display Title --> <xsl:value-of select='.'/> </th> </xsl:for-each> This create the <TH> tag with all its proper attributes just fine! (Thanks Jeni!) 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? Thanks Walter =========================== Sample Data =========================== <interaction_list> <interaction id='19766'> <source> <date>2001-01-16T10:14:21</date> <media_type id='103'>Phone</media_type> <channel id='1'><unspecified></channel> <ani></ani> <dnis></dnis> <route_type>I</route_type> </source> <events> <call_event id='34757'> <date>2001-01-16T10:14:40</date> <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'><unspecified></to_dest> <nav_code id='1'><unspecified></nav_code> <rule id='1'><unspecified></rule> <greeting id='1'><unspecified></greeting> <call_type id='1'><unspecified></call_type> <ext_call id='1'><unspecified></ext_call> <old_call_record id='1'><unspecified></old_call_record> <product id='1'><unspecified></product> <reason id='198'>Case Resolution</reason> <comment>test</comment> </call_event> </events> </interaction> <interaction_list> =========================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] How to use an attribute v, Nate Austin | Thread | Re: [xsl] retrive data from #1 xml , Walter Torres |
Re: [xsl] Moving on, 1 to 1.1, Sebastian Rahtz | Date | [xsl] Copy namespace definition to , Kishorerc |
Month |