XslGenerator:EventSessionSpeaker

Overview

This template shows how to have a multi-node XML source using the DynamicXmlBuilder. In this example, the top node is <event> which has two subnodes: <Session> and <Track>. The <Session> node has a subnode for <Speaker>.

The display shows the Event, with the Session(s) and Track(s) underneath. Within each session, we output the speaker(s) at that session.

Content Detail Definition

Definition and XSL

Important! The SQL commands on this page can be improved with SQL 2005's FOR XML PATH mode syntax. This feature is available in the 2007.01 build and later. Please see XWeb:ExecuteMethod_Case_Study1 for details on how to work with this new feature. These samples are still valid, but it is recommended that you use the newer syntax if your netFORUM site is on 2007.01 or later. Both DynamicXmlBuilder and XslGenerator work with this newer SQL syntax.

{BeginXmlBuilderXml}
<EventList>
<Event>
<sql>
select evt_title, evt_key
from ev_event (nolock)
where getdate() between evt_post_to_web_date and evt_remove_from_web_date
and evt_delete_flag = 0
order by evt_start_date desc
</sql>
<Session>
<sql>
select ses_title, ses_key, ses_evt_key
from ev_session (nolock)
where ses_evt_key = {evt_key}
</sql>
<Speaker>
<sql>
select cst_sort_name_dn
 
from ev_event_faculty (nolock)
 
JOIN ev_event_speaker (nolock)
ON fac_key=spk_fac_key
JOIN co_customer (nolock)
ON fac_cst_key=cst_key
JOIN ev_session (nolock)
ON fac_ses_key=ses_key
where
fac_delete_flag=0
and fac_ses_key={ses_key}
order by
cst_sort_name_dn
 
</sql>
</Speaker>
</Session>
<Track>
<sql>
select
trk_name
From
ev_track (nolock)
where
trk_delete_flag=0 AND
trk_evt_key={evt_key}
</sql>
</Track>
</Event>
</EventList>
{EndXmlBuilderXml}
 
 
{BeginXsl}
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="EventList">
<DIV>
<xsl:apply-templates select="Event" />
</DIV>
</xsl:template>
 
<xsl:template match="Event">
<DIV>
<span class="tinyTXT">
<strong>
<xsl:value-of select="evt_title" />
</strong>
</span>
 
<p />
 
<span class="tinyTXT" style="PADDING-LEFT: 10px; WIDTH: 98%; PADDING-TOP: 4px">
<i>Sessions</i>
</span>
 
<xsl:apply-templates select="Session" />
 
<p />
 
<span class="tinyTXT" style="PADDING-LEFT: 10px; WIDTH: 98%; PADDING-TOP: 4px">
<i>Tracks</i>
</span>
 
<xsl:apply-templates select="Track" />
<p />
</DIV>
</xsl:template>
 
<xsl:template match="Session">
<DIV>
<span class="tinyTXT" style="PADDING-LEFT: 20px; WIDTH: 98%; PADDING-TOP: 4px"><xsl:value-of select="ses_title" /></span>
</DIV>
 
<span class="tinyTXT" style="PADDING-LEFT: 30px; WIDTH: 98%; PADDING-TOP: 4px"><i>Speakers</i></span>
<xsl:apply-templates select="Speaker" />
 
</xsl:template>
 
<xsl:template match="Speaker">
<DIV>
<span class="tinyTXT" style="PADDING-LEFT: 40px; WIDTH: 98%; PADDING-TOP: 4px"><xsl:value-of select="cst_sort_name_dn" /></span>
</DIV>
</xsl:template>
 
<xsl:template match="Track">
<DIV>
<span class="tinyTXT" style="PADDING-LEFT: 20px; WIDTH: 98%; PADDING-TOP: 4px"><xsl:value-of select="trk_name" /></span>
</DIV>
</xsl:template>
 
</xsl:stylesheet>
{EndXsl}
   

XML

The code above will produce XML of this format: This SQL will produce the following XML:

<EventList>
<Event>
<evt_title>2008 ASTC Annual Technology Conference</evt_title>
<evt_key>3790A7C0-823C-4F09-89CE-109DF2C58282</evt_key>
<Session>
<ses_title>Awards Dinner</ses_title>
<ses_key>B601CE5A-2D6B-4282-ADAC-2D591367437D</ses_key>
<ses_evt_key>3790A7C0-823C-4F09-89CE-109DF2C58282</ses_evt_key>
</Session>
<Session>
<ses_title>Technology and the Association</ses_title>
<ses_key>97ADA72D-D81C-4947-B049-C3C443BFD338</ses_key>
<ses_evt_key>3790A7C0-823C-4F09-89CE-109DF2C58282</ses_evt_key>
<Speaker>
<cst_sort_name_dn>Harrell Irene</cst_sort_name_dn>
</Speaker>
<Speaker>
<cst_sort_name_dn>Thurston Scott</cst_sort_name_dn>
</Speaker>
</Session>
<Track>
<trk_name>Exam Track</trk_name>
</Track>
<Track>
<trk_name>Certification Track</trk_name>
</Track>
</Event>
<Event>
<evt_title>Partnership Conference</evt_title>
<evt_key>C677D959-3DA6-471F-BAB8-376CA55E4484</evt_key>
<Session>
<ses_title>Introduction</ses_title>
<ses_key>E11E16AF-FF02-451A-BD46-019DD917E363</ses_key>
<ses_evt_key>C677D959-3DA6-471F-BAB8-376CA55E4484</ses_evt_key>
<Speaker>
<cst_sort_name_dn>Miller Robert</cst_sort_name_dn>
</Speaker>
</Session>
</Event>
</EventList>