[Home] [By Thread] [By Date] [Recent Entries]
Hi Allison,
Your <xsl:apply-templates select="../../Performers"/> will cause the <xsl:template match="Performers"> to be matched exactly in the same context as it was matched initially when you called <xsl:apply-templates select="Performers"> <xsl:with-param name="performerLevels" select="2"/> </xsl:apply-templates> This causes an infinite loop. A possible solution is to iterate first the individual speakers and print their information, then all the group performers and print group info. If you define two keys to match moderators and speakers for each group then you can just iterate on moderators and print their info and on speakers and print their info for each group. You can find below such a stylesheet, hope that helps. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:key name="moderators" match="Performer[PerformerTypes/PerformerType[.='Moderator']]" use="PerformerParentID"/> <xsl:key name="speakers" match="Performer[PerformerTypes/PerformerType[.='Speaker']]" use="PerformerParentID"/> <xsl:template match="/"> <!-- Determine which TIMEFRAME to render --> <html> <body> Here are the events: <xsl:choose> <xsl:when test="/Events/View/Timeframe='event'"> <xsl:call-template name="TimeframeEvent"/> </xsl:when> <xsl:when test="/Events/View/Timeframe='day'"> Do nothing </xsl:when> </xsl:choose> </body> </html> </xsl:template> <xsl:template name="TimeframeEvent"> <xsl:for-each select="/Events/Event[@type='EventDetail'][position()<= 1]"> <br/> <div class="event"> <xsl:apply-templates select="Performers"/> </div> </xsl:for-each> </xsl:template> <xsl:template match="Performers"> <xsl:for-each select="Performer[not(PerformerParentID) and not(PerformerTypes/PerformerType[.='Group'])]"> <!-- Individual performers --> <p> <xsl:text>Featured speaker:</xsl:text> <xsl:call-template name="printPerformerInfo"/> </p> </xsl:for-each> <xsl:for-each select="Performer[PerformerTypes/PerformerType[.='Group']]"> <!-- Groups --> <p> <xsl:text>Performer Group:</xsl:text> <xsl:value-of select="Name/FullName"/> <xsl:variable name="moderators" select="key('moderators', PerformerID)"/> <xsl:variable name="speakers" select="key('speakers', PerformerID)"/> <p> <label>Moderator<xsl:if test="count($moderators) > 1">s</xsl:if>: </label> <xsl:for-each select="$moderators"> <xsl:call-template name="printPerformerInfo"/> <xsl:if test="not(last() =position())"> <xsl:text>; </xsl:text> </xsl:if> </xsl:for-each> <br/> <xsl:for-each select="$speakers"> <label>Speaker: </label> <xsl:call-template name="printPerformerInfo"/> <xsl:if test="not(last() =position())"> <br/> </xsl:if> </xsl:for-each> </p> </p> </xsl:for-each> </xsl:template> <xsl:template name="printPerformerInfo"> <xsl:choose> <xsl:when test="WebPages/WebPage/URL != ''"> <a href="{WebPages/WebPage/URL}"> <xsl:value-of select="Name/FullName"/> </a> </xsl:when> <xsl:otherwise> <xsl:value-of select="Name/FullName"/> </xsl:otherwise> </xsl:choose> <xsl:if test="ProfessionalAffiliations/ProfessionalAffiliation/JobTitles/JobTitle != ''">, <xsl:value-of select="ProfessionalAffiliations/ProfessionalAffiliation/JobTitles/JobTitle"/> </xsl:if> <xsl:if test="ProfessionalAffiliations/ProfessionalAffiliation/OrganizationName != ''">, <xsl:choose> <xsl:when test="ProfessionalAffiliations/ProfessionalAffiliation/OrganizationWebPages/WebPage/URL != ''"> <a href="{ProfessionalAffiliations/ProfessionalAffiliation/OrganizationWebPages/WebPage/URL}"> <xsl:value-of select="ProfessionalAffiliations/ProfessionalAffiliation/OrganizationName" /> </a> </xsl:when> <xsl:otherwise> <xsl:value-of select="ProfessionalAffiliations/ProfessionalAffiliation/OrganizationName"/> </xsl:otherwise> </xsl:choose> </xsl:if> </xsl:template> </xsl:stylesheet> On something like
<?xml version="1.0" encoding="UTF-8"?>
<Events>
<View>
<Timeframe>event</Timeframe>
</View>
<Event type="EventDetail">
<EventID>1300</EventID>
<EventTitle>Daily recurring event 18</EventTitle>
<DateTime>
<TimeStamp>1157396400</TimeStamp>
<StartDate>2006-09-04</StartDate>
<StartTime>12:00:00</StartTime>
<EndDate>2006-09-04</EndDate>
<EndTime>12:00:00</EndTime>
</DateTime>
<Performers>
<Performer>
<PerformerID>2018</PerformerID>
<Name>
<FullName>Performer group</FullName>
</Name>
<PerformerTypes>
<PerformerType>Group</PerformerType>
</PerformerTypes>
<WebPages>
<WebPage> <URL>http://www.joffrey.com/</URL>
</WebPage>
</WebPages>
</Performer>
<Performer>
<PerformerID>2019</PerformerID>
<Name>
<FullName>Performer in Performer Group</FullName>
</Name>
<PerformerTypes> <PerformerType>Moderator</PerformerType>
</PerformerTypes>
<ProfessionalAffiliations>
<ProfessionalAffiliation>
<JobTitles> <JobTitle>Performer</JobTitle>
</JobTitles> <OrganizationName>Org</OrganizationName>
<OrganizationWebPages>
<WebPage> <URL>http://www.org.com</URL>
</WebPage>
</OrganizationWebPages>
</ProfessionalAffiliation>
</ProfessionalAffiliations>
<WebPages>
<WebPage><URL>http://www.performer.com</URL> </WebPage> </WebPages> <PerformerParentID>2018</PerformerParentID> </Performer> <Performer> <PerformerID>2019</PerformerID> <Name> <FullName>Performer Speaker in Performer Group</FullName> </Name> <PerformerTypes> <PerformerType>Speaker</PerformerType>
</PerformerTypes>
<ProfessionalAffiliations>
<ProfessionalAffiliation>
<JobTitles> <JobTitle>Performer</JobTitle>
</JobTitles> <OrganizationName>Org</OrganizationName>
<OrganizationWebPages>
<WebPage> <URL>http://www.org.com</URL>
</WebPage>
</OrganizationWebPages>
</ProfessionalAffiliation>
</ProfessionalAffiliations>
<WebPages>
<WebPage> <URL>http://www.performer.com</URL>
</WebPage>
</WebPages>
<PerformerParentID>2018</PerformerParentID>
</Performer> <Performer>
<PerformerID>2019</PerformerID>
<Name>
<FullName>Performer InNoGroup</FullName>
</Name>
<PerformerTypes>
<PerformerType>None</PerformerType>
</PerformerTypes>
<ProfessionalAffiliations>
<ProfessionalAffiliation>
<JobTitles>
<JobTitle>Performer</JobTitle>
</JobTitles>
<OrganizationName>Org</OrganizationName>
<OrganizationWebPages>
<WebPage>
<URL>http://www.org.com</URL>
</WebPage>
</OrganizationWebPages>
</ProfessionalAffiliation>
</ProfessionalAffiliations>
<WebPages>
<WebPage> <URL>http://www.performer.com</URL>
</WebPage>
</WebPages> </Performer>
</Performers>
</Event>
</Events>it gives Here are the events: Featured speaker:Performer InNoGroup, Performer, Org Performer Group:Performer group Moderator: Performer in Performer Group, Performer, Org Speaker: Performer Speaker in Performer Group, Performer, Org
Allison Bloodworth wrote: Hi,
|

Cart



