I am trying to join 3 SQL tables together in an XSLT string. I have successfully joined 2 tables together using INNER JOIN and the like, but I have a slightly more complicated need that requires 3 joined tables.
The 3 tables are:
1) web_YouTube, which contains each video's information.
2) web_Programs, which contains each academic program's info (college, seminary, etc)
3) web_Programs_Videos, which is a 'switchboard' table that pulls together program ID's from web_Programs and video ID's from web_YouTube. I have academic program pages that displays videos according to this combination of IDs.
Here's the tricky part:
I am building "study area" pages that list the different levels of study available for each course area (whether or not you can take a minor, AA, BA, MA, MDiv, or Certificate in any study area, such as Biblical Studies, Humanities, Geography, English, etc.). These study area pages will link to the program pages, where program-specific info will be listed.
All of this area-of-study info is held in a table called web_Areas_of_Study, The web_Programs table links each academic program to an area of study by the area of study's ID number from web_Areas_of_Study.
The trouble I am having is that I am trying to access the program_StudyArea from web_Programs so that I can display videos from web_YouTube that pertain to the area of study.
I could simplify things by creating another switchboard table that lists videos by study area rather than by program, but I am hoping to avoid this so that the people managing the content don't have to upkeep two different video lists.
So, if you're still with me, how do I go about joining web_YouTube, web_Programs_Videos, and web_Programs together? Below is the JOIN I attempted, but so far no luck. I'm still a novice with XSLT, so any input will be most gratefully received.
<xsl:variable name = "studyAreaVideos" select="SQL:GetDataSet('DBname', concat( 'SELECT YouTubeID, VideoDisplay, VideoPosted, YouTubeCode, progvid_ProgramID, progvid_VideoID, progvid_Sort, program_Id, program_StudyArea FROM web_YouTube INNER JOIN web_Programs_Videos ON web_YouTube.YouTubeID = web_Program_Videos.progvid_VideoIDramID JOIN web_Programs ON web_Programs.program_Id = web_Programs_Videos.progvid_ProgramID WHERE web_Programs.program_StudyArea = ', $studyAreaVideosID), 'studyAreaVideos')"/>
<div class = "videodisplay"> <xsl:for-each select="$studyAreaVideos//studyAreaVideos"> <xsl:sort select="progvid_Sort" order="ascending" />
I would definitely go seek the help of the SQL gods on stackoverflow.com - this is not an XSLT question by a far stretch :-)
Really, these couldn't be better separated: The extension gets the data and XSLT transforms them into HTML.
I can give you some hints for the XSLT, though: Theelements are only necessary when you don't know the name beforehand, otherwise they add serious noise - you can accomplish the exact same thing with much less:
Thanks, Chriztian! I'll throw a question to Stack Overflow. And thanks for the XSLT tips. I learned the attributes method at the beginning, but I need to cut the cord!
Join 3 SQL tables in XSLT
I am trying to join 3 SQL tables together in an XSLT string. I have successfully joined 2 tables together using INNER JOIN and the like, but I have a slightly more complicated need that requires 3 joined tables.
The 3 tables are:
1) web_YouTube, which contains each video's information.
2) web_Programs, which contains each academic program's info (college, seminary, etc)
3) web_Programs_Videos, which is a 'switchboard' table that pulls together program ID's from web_Programs and video ID's from web_YouTube. I have academic program pages that displays videos according to this combination of IDs.
Here's the tricky part:
I am building "study area" pages that list the different levels of study available for each course area (whether or not you can take a minor, AA, BA, MA, MDiv, or Certificate in any study area, such as Biblical Studies, Humanities, Geography, English, etc.). These study area pages will link to the program pages, where program-specific info will be listed.
All of this area-of-study info is held in a table called web_Areas_of_Study, The web_Programs table links each academic program to an area of study by the area of study's ID number from web_Areas_of_Study.
The trouble I am having is that I am trying to access the program_StudyArea from web_Programs so that I can display videos from web_YouTube that pertain to the area of study.
I could simplify things by creating another switchboard table that lists videos by study area rather than by program, but I am hoping to avoid this so that the people managing the content don't have to upkeep two different video lists.
So, if you're still with me, how do I go about joining web_YouTube, web_Programs_Videos, and web_Programs together? Below is the JOIN I attempted, but so far no luck. I'm still a novice with XSLT, so any input will be most gratefully received.
Hi Luke,
I would definitely go seek the help of the SQL gods on stackoverflow.com - this is not an XSLT question by a far stretch :-)
Really, these couldn't be better separated: The extension gets the data and XSLT transforms them into HTML.
I can give you some hints for the XSLT, though: Theelements are only necessary when you don't know the name beforehand, otherwise they add serious noise - you can accomplish the exact same thing with much less:
Also note that the ampersands should be properly escaped - always. It's actually required even in HTML.
/Chriztian
Thanks, Chriztian! I'll throw a question to Stack Overflow. And thanks for the XSLT tips. I learned the attributes method at the beginning, but I need to cut the cord!
is working on a reply...