Subject: [xsl] Re: retrieve data from #1 xml via data from #2 xml (again) From: Walter Torres <walter@xxxxxxxxx> Date: Wed, 4 Apr 2001 17:14:41 -0500 (CDT) |
> -----Original Message----- > From: Jeni Tennison [mailto:mail@xxxxxxxxxxxxxxxx] > Sent: Friday, March 23, 2001 5:37 AM > To: Walter Torres > Cc: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Re: [xsl] Re: retrieve data from #1 xml via data from #2 xml > > > Hi Walter, > > > My problem with this is that when I run this, I get 3 rows, as I > > should but I also get all 12 fields, not just the 6 as defined in > > tableData. > > Please can you post the sample data, sample tableData and the XSLT > stylesheet that you're using. It's really impossible to tell just > from your description what's going wrong. Sorry, Jeni; Been hip deep in dudu of late. :( Anyway, here is my issue, restated with examples. [All sample data is at the bottom of the file.] I defined my variables thus... <xsl:variable name="data" select="/callEvent//interaction" /> <xsl:variable name="columns" select="document('tableData.xml')/titles/display/@id" /> This works nice. I get data as I think I should. > So if you want to iterate over the interaction elements, then you can > either change it so that the node that the column ids are resolved > relative to are the events/call_event grandchildren of the interaction > element with: > > <tr> > <xsl:for-each select="$data"> > <xsl:variable name="datum" select="events/call_event" /> > <xsl:for-each select="$columns"> > <xsl:variable name="column" select="." /> > <td> > <xsl:value-of select="$datum/*[name() = $column]" /> > </td> > </xsl:for-each> > </xsl:for-each> > </tr> I finally get what this is doing! But it's not helping, (well, it mostly is but...) [ My dummy data has 3 records, 12 fields My tabelData has 6 of the above 12 fields Thats all I want to see, a sub set ] My problem with this is that when I run this, I get 3 rows, as I should but I also get all 12 fields, not just the 6 as defined in tableData. So I figure I need some conditional in here to see if the current NODE is part of the tableData NODE set. I just can't figure how to get that piece of info out of the 'variable' set I have. After several days of banging my head against the wall I thought I would ask for help (again!). Walter ===================== Display data - tableData.xml ===================== <titles> <display id='source/timestamp' colWidth='104' defaultSort='T'>Date</display> <display id='curr_dest' colWidth='060' defaultSort='F'>Agent</display> <display id='media' colWidth='060' defaultSort='F'>Channel</display> <display id='reason' colWidth='120' defaultSort='F'>Reason</display> <display id='detailed_comment' colWidth='*' defaultSort='F'>Comments</display> </titles> ===================== Sample Data - history.xml ===================== <callEvent> <response> <interaction_list> <interaction id='19766'> <source> <timestamp>2001-01-16T10:14:21</timestamp> <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'> <timestamp>2001-01-16T10:14:40</timestamp> <call_event_type id='28'>eMail</call_event_type> <customer id='2124'>Harris</customer> <curr_dest id='103'>Vincent</curr_dest > <to_dest id='1'><unspecified></to_dest> <nav_code id='1'></nav_code> <rule id='1'></rule> <greeting id='1'></greeting> <call_type id='1'></call_type> <ext_call id='1'></ext_call> <old_call_record id='1'></old_call_record> <product id='1'></product> <reason id='198'>Case Resolution</reason> <detailed_comment>test</detailed_comment> </call_event> </events> </interaction> <interaction id='19767'> <source> <timestamp>9999-01-16T10:04:48</timestamp> <media_type id='103'>inquiry</media_type> <channel id='1'><unspecified></channel> <ani></ani> <dnis></dnis> <route_type>I</route_type> </source> <events> <call_event id='34759'> <timestamp>2001-01-16T10:12:19</timestamp> <call_event_type id='27'>phone</call_event_type> <customer id='2124'>Harris</customer> <curr_dest id='103'>Vincent</curr_dest > <to_dest id='1'><unspecified></to_dest> <nav_code id='1'></nav_code> <rule id='1'></rule> <greeting id='1'></greeting> <call_type id='1'></call_type> <ext_call id='1'></ext_call> <old_call_record id='1'></old_call_record> <product id='1'></product> <reason id='98'>Case Resolution</reason> <detailed_comment>testing 10:10 AM</detailed_comment> </call_event> </events> </interaction> <interaction id='19768'> <source> <timestamp>2001-01-16T10:30:16</timestamp> <media_type id='103'>inquiry</media_type> <channel id='1'><unspecified></channel> <ani></ani> <dnis></dnis> <route_type>I</route_type> </source> <events> <call_event id='34768'> <timestamp>2001-01-16T10:31:03</timestamp> <call_event_type id='28'>eMail</call_event_type> <customer id='2124'>Harris</customer> <curr_dest id='103'>Vincent</curr_dest > <to_dest id='1'><unspecified></to_dest> <nav_code id='1'></nav_code> <rule id='1'></rule> <greeting id='1'></greeting> <call_type id='1'></call_type> <ext_call id='1'></ext_call> <old_call_record id='1'></old_call_record> <product id='1'></product> <reason id='98'>Case Resolution</reason> <detailed_comment>test 10:30am</detailed_comment> </call_event> </events> </interaction> </interaction_list> <event_count>317</event_count> <stats> <time_for_query>580-milliseconds</time_for_query> <result_set_time>1-second 723-milliseconds</result_set_time> <total_time>2-seconds 374-milliseconds</total_time> </stats> </response> </callEvent> ===================== <eof> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: XSL-List Digest V3 #665, David Marsh | Thread | Re: [xsl] Re: retrieve data from #1, Jeni Tennison |
Re: [xsl] xsl to xsl doing it right, David Carlisle | Date | Re: [xsl] Handling  , David Carlisle |
Month |