IT WORKED!!! Thanks Cerebrus!!!! :) I was trying to play around with xsl:variable before, but couldn't figure out how to use it along with xsl:param in this context - I learned something new! I'm also looking into xsl:call-template... Thanks again for the help! -Ena
On Jan 12, 3:17 pm, Ena <[email protected]> wrote: > " Ignoring the fact that your XSL appears to do the same thing if the > Category matches and if it doesn't match..." > > - Ha ha!... oops! - I forgot to mention that this is a scaled down > version of the code - I have about 5 other categories that the > "<xsl:when test="$myXSLcategory='f' ">blah blah blah <xsl:when>" > statement tests for. If no conditions are met, the results default to > the "f" category. It's probably kinda clunky (I'm a newbie ast XSLT). > If you have any suggestions on how to do this more efficiently, I'd > gladly try it. I'm concerned about this method of testing for > categories getting too cumbersome as I add new categories over time. > > THANKS for the initial help as well! - I'll try it now and keep you > posted ;) > > -Ena > > On Jan 12, 12:44 pm, Cerebrus <[email protected]> wrote: > > > > > Ignoring the fact that your XSL appears to do the same thing if the > > Category matches and if it doesn't match, this appears to be a simple > > case of applying the appropriate XPath to filter out nodes which match > > the alumniID parameter (which you would pass to the XSLT in the same > > way as the other parameters). > > > Here's the relevant part of the (modified) XSLT : > > > --- > > <xsl:when test="$myXSLcategory='f' "> > > <xsl:variable name="numProfiles" select="alumniProfiles/profi...@id ! > > = $alumniID]" /> > > <xsl:choose> > > <xsl:when test="count($numProfiles) = 0"> > > <xsl:call-template name="NoResults" /> > > </xsl:when> > > <xsl:otherwise> > > <xsl:for-each select="$numProfiles"> > > <xsl:choose> > > <xsl:when test="function = $myXSLmatchme"> > > <li> > > <a> > > <xsl:attribute name="href"> > > <xsl:value-of select="link"/>?ref=f > > </xsl:attribute> > > <xsl:value-of select="careerTopics/topic/title"/> > > <strong> > >   -  > > <xsl:value-of select="firstName"/> > >   > > <xsl:value-of select="lastName"/> > > </strong> > > </a> > > </li> > > <br /> > > </xsl:when> > > </xsl:choose> > > </xsl:for-each> > > </xsl:otherwise> > > </xsl:choose> > > </xsl:when> > > <xsl:otherwise> > > ... > > ... > > </xsl:otherwise> > > > ... > > ... > > <xsl:template name="NoResults"> > > <p> > > Sorry, No other related links at this time. > > </p> > > </xsl:template> > > > --- > > > Hope this helps ! > > > On Jan 12, 9:09 pm, Ena <[email protected]> wrote: > > > > Hi, > > > > I have a webpage that contains a person's bio and profile (50 pages, > > > 50 > > > profiles). On the page, below the bio, are a list of links relate to > > > the > > > current profile. The links are pulled into the page based on matching > > > the > > > variables declared in the .aspx page to the values of nodes in the > > > xml. If I > > > am using the following XSLT code to display links on the page that > > > are > > > related to the current page: > > > > <xsl:param name="myXSLmatchme" select="blank"/> > > > <xsl:param name="myXSLcategory" select="blank"/> > > > <xsl:param name="alumniID" select="blank"/> > > > > <xsl:template match="/"> > > > <table cellpadding="20"> > > > <tr> > > > <td> > > > <ul id="relatedprofiles"> > > > <xsl:choose> > > > > <xsl:when test="$myXSLcategory='f' "> > > > <xsl:for-each select="alumniProfiles/profile"> > > > <xsl:choose> > > > <xsl:when test="function = $myXSLmatchme"> > > > <li> > > > <a> > > > <xsl:attribute name="href"> > > > <xsl:value-of select="link"/>?ref=f > > > </xsl:attribute> > > > <xsl:value-of > > > select="careerTopics/topic/title"/> > > > <strong> - > > > <xsl:value-of select="firstName"/> > > > <xsl:value-of select="lastName"/> > > > </strong> > > > </a> > > > </li> > > > <br /> > > > </xsl:when> > > > </xsl:choose> > > > </xsl:for-each> > > > </xsl:when> > > > > <xsl:otherwise> > > > <xsl:for-each select="alumniProfiles/profile"> > > > <xsl:choose> > > > <xsl:when test="function = $myXSLmatchme"> > > > <li> > > > <a> > > > <xsl:attribute name="href"> > > > <xsl:value-of select="link"/>?ref=f > > > </xsl:attribute> > > > <xsl:value-of > > > select="careerTopics/topic/title"/> > > > <strong> - > > > <xsl:value-of select="firstName"/> > > > <xsl:value-of select="lastName"/> > > > </strong> </a> > > > </li> > > > <br /> > > > </xsl:when> > > > </xsl:choose> > > > </xsl:for-each> > > > </xsl:otherwise> > > > > </xsl:choose> > > > </ul> > > > </td> > > > </tr> > > > </table> > > > </xsl:template> > > > </xsl:stylesheet> > > > > ...and I am determining which links are related to the person on the > > > page by > > > matching values defined in the .aspx this way: (*"alumniID"* is a > > > unique > > > value) > > > > <script runat="server"> > > > void Page_Load () { > > > string industry="Banking"; > > > string function="Consulting"; > > > string geography="United States"; > > > string experience="20-25 Years"; > > > string theme="Conducting an Effective Global Job Search"; > > > string keyword=""; > > > string alumniID="0035"; > > > string myref="f"; > > > string matchme=""; > > > XsltArgumentList parameters = new XsltArgumentList(); > > > if (Request.QueryString["ref"] == null) { > > > > } else { > > > > myref=Request.QueryString["ref"]; > > > > } > > > > switch(myref){ > > > case "f": > > > matchme=function; > > > break; > > > case "i": > > > matchme=industry; > > > break; > > > case "e": > > > matchme=experience; > > > break; > > > case "t": > > > matchme=theme; > > > break; > > > case "g": > > > matchme=geography; > > > break; > > > default: > > > matchme=function; > > > break; > > > > } > > > > parameters.AddParam("myXSLmatchme", "", matchme); > > > parameters.AddParam("myXSLcategory", "", myref); > > > > XsltProcessor1.TransformArgumentList = parameters; > > > > } > > > > </script> > > > > How would I pull in the "alumniID" value of the current page and use > > > it to > > > exclude that profile link from the results? > > > > Also, how do I display and alternate message like "No other related > > > links at > > > this time" if there are no other related links? > > > > The XML: > > > > <alumniProfiles> > > > > <profile id="0001"> > > > <firstName>Alexis</firstName> > > > <lastName>Sermeno</lastName> > > > <link>/alumniprofiles/profiles/sermeno.aspx</link> > > > <function>Consulting</function> > > > <industry>Consulting</industry> > > > <yearsExperience>15-20 Years</yearsExperience> > > > <geography> > > > <location primary="yes"> > > > <continent>North America</continent> > > > <country>United States</country> > > > <state>Illinois</state> > > > <city>Chicago</city> > > > </location> > > > </geography> > > > <careerTopics> > > > <topic> > > > <theme>What's Your Story</theme> > > > <title>"I went from corporate to consulting"</title> > > > </topic> > > > </careerTopics> > > > </profile> > > > > </alumniProfiles> > > > > Any help would be appreciated - Thanks > > > > -Ena- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text -
