changing the format of results based on client information

Post Reply
opher.lichter
Posts: 2
Joined: Tue Jan 10, 2006 11:13 am

changing the format of results based on client information

Post by opher.lichter »

Is it possible to send information to the Thunderstone search appliance that would tell it to reformat all result URLs to SMB://server/share/filename.ext instead of file://server/share/filename.ext.

This format would work better on the Macintosh platform and if we could send along the client information (pc vs mac), could we re-format the result URLs to cater to the client?
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

changing the format of results based on client information

Post by mark »

Possibly you could translate the urls when using the XSL style sheet. But I don't know how. I don't think any client info is available to the XSL processor. You could include some javascript in the links to do the translation on the fly in the browser.
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

changing the format of results based on client information

Post by mark »

Here are XSL mods you can make for macintosh compatible file: urls (or other url translation on output).

Add HTTP_USER_AGENT to the XML Export Vars setting under search settings.

In the XSL style sheet after
<xsl:preserve-space elements="Abstract" />
Add
<xsl:variable name="HTTP_USER_AGENT"><xsl:value-of select="/ThunderstoneResults/exportVar/variable[@name='HTTP_USER_AGENT']"/></xsl:variable>

In the XSL style sheet after
<xsl:template match="Result" mode="list">
Add
<xsl:variable name="Url">
<xsl:if test="contains($HTTP_USER_AGENT,'Macintosh')">
<xsl:value-of select="concat('file:///Volumes/',substring-after(Url,'file://THESERVER/'))"/>
</xsl:if>
<xsl:if test="not(contains($HTTP_USER_AGENT,'Macintosh'))">
<xsl:value-of select="Url"/>
</xsl:if>
</xsl:variable>
Adjusting "file://THESERVER/" to the prefix of the url in the database you need to change
and "file:///Volumes/" for what to change the prefix to.

In the XSL style sheet change (prepend $ to Url)
<A><xsl:attribute name="HREF"><xsl:value-of select="Url"/></xsl:attribute>
to
<A><xsl:attribute name="HREF"><xsl:value-of select="$Url"/></xsl:attribute>
Post Reply