Using a Little XSL Magic in Your MOSS Search Results
I love to hate XSL. It drives me absolutely crazy sometimes to get the syntax just right (XSL is so unforgiving) but, when things work, you can do so much with so few lines of code. Here's a snippet I used recently to add a hyperlink in a MOSS search result to allow the user to ignore all other criteria used and just focus on a specific managed property. See my previous post on helpful hints on search url syntax.
This snippet create a hyperlink that executes a new search with just a managed property filter on. The trickiest part was getting the syntax of the URL just right. I could not use a '&' character as it caused an error in the XSL. I had to use an '&' instead. Happy coding!
-- <xsl:when test="mymanagedproperty[. != '']">
-- <xsl:element name="a">
-- <xsl:attribute name="href">
-- <xsl:value-of select="concat('http://myserver/results.aspx?s=MySource&k=MyManagedProperty:',mymanagedproperty)"/>
-- </xsl:attribute>
-- </xsl:element>
-- <xsl:value-of select="mymanagedproperty"/>
-- </xsl:when>