This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Fw: Re: retrieve data from #1 xml via data from #2 xml (again)
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: Fw: [xsl] Re: retrieve data from #1 xml via data from #2 xml (again)
- From: "Walter Torres" <walter at torres dot ws>
- Date: Fri, 13 Apr 2001 11:42:20 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
----- Original Message -----
From: "Jeni Tennison" <mail@jenitennison.com>
To: "Walter Torres" <walter@torres.ws>
Cc: <xsl-list@lists.mulberrytech.com>
Sent: Wednesday, April 11, 2001 12:33 PM
Subject: Re: [xsl] Re: retrieve data from #1 xml via data from #2 xml
(again)
> Hi Walter,
<snip>
> Anyway, that's a complete guess - if you post your stylesheet then it
> would be a lot easier to debug it for you.
OK, here is my XSLT file.
Second attempt, it seems that my attached file was rejected by the server.
And it took 3 days to tell me it was rejected.
Walter
=================
<xsl:stylesheet version='1.0'
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match='callEvent/response/interaction_list'>
<html>
<head>
<title>This is a history display test 3 - XSLT </title>
</head>
<body>
<!-- get ID in table order -->
<!-- 'STYLE="table-layout:fixed">' adds before display performance to
tables -->
<table border='0' cellspacing='2' cellpadding='0' width='100%'
STYLE='table-layout:fixed'>
<tr style='display:block;'>
<!-- 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.showMe(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='./@id'/></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>
</tr>
<!-- This will loop for each Interaction in this data stream -->
<!-- This calls the ROOT NODE Template below -->
<xsl:apply-templates />
<!-- <xsl:sort select='./interaction/source/timestamp' order='descending' />
</xsl:apply-templates>
-->
</table>
</body>
</html>
</xsl:template>
<!-- data from primary -->
<xsl:variable name="data"
select="/callEvent//interaction" />
<!-- id list from secondary -->
<xsl:variable name="columns"
select="document('tableData.xml')/titles/display/@id" />
<!-- 'interaction' NODE Template -->
<xsl:template match='interaction'>
<xsl:for-each select="$data">
<tr>
<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>
</tr>
</xsl:for-each>
</xsl:template>
<!-- =============================== Sub templates =============== -->
<!-- timestamp NODE Template -->
<xsl:template match="source/timestamp">
<!-- Pull the pieces apart -->
<xsl:variable name='datetime' select='.' />
<xsl:variable name='year' select='substring( $datetime, 0 , 5 )' />
<xsl:variable name='month' select='substring( $datetime, 6 , 2 )' />
<xsl:variable name='day' select='substring( $datetime, 9 , 2 )' />
<td valign='top'>
<!-- put the date together in American order -->
<xsl:value-of select="concat($month, '/', $day, '/', $year )" />
<!-- Seperate the date and Time -->
-
<!-- Display the Time -->
<xsl:value-of select='substring( $datetime, 12 , 9 )' />
</td>
</xsl:template>
<!-- reasons NODE Template -->
<xsl:template match='reason'>
<td valign='top'>
<div style='display:block;'
onClick='parent.showBlock(this, this.nextSibling)'>
<xsl:value-of select="." />
</div>
<div style='display:none; background-color="red";'
onClick='parent.showBlock(this, this.previousSibling)'>
<xsl:for-each select=".">
<xsl:number />:
<xsl:value-of select='.' /><br />
</xsl:for-each>
</div>
</td>
</xsl:template>
<!-- general NODE Template -->
<xsl:template match='media_type | curr_dest | detailed_comment'>
<td valign='top'>
<xsl:value-of select="." />
</td>
</xsl:template>
</xsl:stylesheet>
<!-- eof -->
================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list