LisaGraves
Programmer
I am currently using XML and XSL files to create a menu bar. I am needing to be able to capture the current URL where the XML & XSL files are called to load in order to use it within the XSL in a conditional statement. I am trying to load the menu a different way depending on what URL they are on. The current XSL file being used is below. I was on the track of using VBScribt to pick up the URL value, but can't seem to get XSL to recognize the variable being passed from VBScript. Is there an easier way? Any ideas?
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl=" version="1.0">
<xslutput method="html"/>
<xsl:template match="/">
<xslaram name="subdashxml"/>
<xsl:apply-templates select="MENUBAR" />
</xsl:template>
<xsl:template match="MENUBAR">
<link rel="stylesheet" type="text/css" href="/portalweb/navigation/dhtml.css"/>
<script type="text/javascript" src="/portalweb/navigation/menu.js"></script>
<table cellpadding="0" cellspacing="0" border="0">
<tr><td>
<table id="menu" border="0" height="10" cellspacing="1" onselectstart="return false" onmouseover="menuOver()" onmouseout="menuOut()" onclick="menuClick()">
<tr id="menubar">
<xsl:for-each select="MENU">
<xsl:choose>
<xsl:when test="TITLE = 'People'">
<td CLASS="root" NOWRAP="true"><b><font color="white"><xsl:value-of select="TITLE"/></font></b>
<xsl:call-template name="submenu"/>
</td>
</xsl:when>
<xsltherwise>
<td CLASS="root" NOWRAP="true"><b><xsl:value-of select="TITLE" disable-output-escaping="yes" /></b>
<xsl:call-template name="submenu" />
</td>
</xsltherwise>
</xsl:choose>
</xsl:for-each>
</tr>
</table>
</td>
<td width="100%" align="right" bgcolor="#1D3D7A">
<SCRIPT LANGUAGE="JavaScript">
// Globalized strings for the java script in the search box part.
var L_strInternalPropErr_TEXT = "Internal error with property fields. Please try another query.";
var L_strContainsNumericErr_TEXT = "Cannot use the Contains operator for numeric properties.";
var L_strDigitsNumericErr_TEXT = "Must use digits 0-9 for numeric properties.";
var L_strContainsDateErr_TEXT = "Cannot use the Contains operator for date-type properties.";
var L_strSearchForSomethingErr_TEXT = "You must specify something to search for.";
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="/bwusa/Portal/resources/searchConstants.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="/bwusa/Portal/resources/searchFunctions.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="/bwusa/Portal/resources/miscFunctions.js"></SCRIPT>
<TABLE border="0" cellpadding="0" cellspacing="0">
<FORM action="/bwusa/Portal/Search" method="post" name="publishing_SearchForm" onSubmit="return generateAndSaveSearchQueries();"> <!-- All the hidden values are here -->
<TR>
<TD>
<INPUT type="hidden" name="publishing_q_ShowAdvanced" value="true"/>
<INPUT type="hidden" name="publishing_q_WasAdvanced" value="true"/>
<INPUT type="hidden" name="publishing_q_StartResultRow" value=""/>
<INPUT type="hidden" name="publishing_q_CarriedBestBetCount" value=""/>
<INPUT type="hidden" name="publishing_qs_clause" value=""/>
<INPUT type="hidden" name="publishing_q_categories" value=""/>
<INPUT type="hidden" name="publishing_q_documents" value=""/>
<INPUT type="hidden" name="publishing_q_DateSearchUsed" value=""/>
<INPUT type="hidden" name="publishing_q_PrevCategoryKeywordConstraints" value = "" />
<INPUT type="hidden" name="publishing_q_PrevDocumentKeywordConstraints" value = "" />
<INPUT type="hidden" name="publishing_q_PrevPropertyConstraints" value = "" />
<INPUT type="hidden" name="publishing_q_SubscriptionQuery" value=""/>
<INPUT type="hidden" name="SubscribedSearch" value = "" />
<INPUT type="hidden" name="publishing_q_AutoCatEnabled" value = "true" />
<INPUT type="hidden" name="publishing_q_HiddenKeyword" value = "" />
<SELECT style="display:none" name="publishing_q_SearchScope">
<OPTION value="This site">This site</OPTION></SELECT>
<INPUT name="publishing_q_SearchKeyword" value="" size="15" maxlength="4096"/>
<INPUT style="display:none" type="submit" value=" Go " name="searchButton" />
<img src="/bwusa/portal%20content/go.gif" WIDTH="15" HEIGHT="15" />
</TD>
</TR>
</FORM>
</TABLE>
</td>
</tr>
</table>
</xsl:template>
<xsl:template name="submenu">
<table cellspacing="0" class="menu" style="visibility: hidden;">
<xsl:for-each select="SUBMENU">
<xsl:choose>
<xsl:when test="SUBMENU">
<tr class="sub" nowrap="true">
<td style="padding-left=20px" nowrap="true"><b><xsl:value-of select="TITLE" disable-output-escaping="yes" /></b></td>
<td align="right"><span class="more">4</span>
<xsl:call-template name="submenu" />
</td>
</tr>
</xsl:when>
<xsltherwise>
<tr nowrap="true">
<xsl:attribute name="href">
<xsl:value-of select="URL" />
</xsl:attribute>
<xsl:attribute name="target">_self</xsl:attribute>
<td nowrap="true" colspan="4" style="padding-left:20px;padding-right:20px"><b><xsl:value-of select="TITLE" disable-output-escaping="yes" /></b></td>
</tr>
</xsltherwise>
</xsl:choose>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl=" version="1.0">
<xslutput method="html"/>
<xsl:template match="/">
<xslaram name="subdashxml"/>
<xsl:apply-templates select="MENUBAR" />
</xsl:template>
<xsl:template match="MENUBAR">
<link rel="stylesheet" type="text/css" href="/portalweb/navigation/dhtml.css"/>
<script type="text/javascript" src="/portalweb/navigation/menu.js"></script>
<table cellpadding="0" cellspacing="0" border="0">
<tr><td>
<table id="menu" border="0" height="10" cellspacing="1" onselectstart="return false" onmouseover="menuOver()" onmouseout="menuOut()" onclick="menuClick()">
<tr id="menubar">
<xsl:for-each select="MENU">
<xsl:choose>
<xsl:when test="TITLE = 'People'">
<td CLASS="root" NOWRAP="true"><b><font color="white"><xsl:value-of select="TITLE"/></font></b>
<xsl:call-template name="submenu"/>
</td>
</xsl:when>
<xsltherwise>
<td CLASS="root" NOWRAP="true"><b><xsl:value-of select="TITLE" disable-output-escaping="yes" /></b>
<xsl:call-template name="submenu" />
</td>
</xsltherwise>
</xsl:choose>
</xsl:for-each>
</tr>
</table>
</td>
<td width="100%" align="right" bgcolor="#1D3D7A">
<SCRIPT LANGUAGE="JavaScript">
// Globalized strings for the java script in the search box part.
var L_strInternalPropErr_TEXT = "Internal error with property fields. Please try another query.";
var L_strContainsNumericErr_TEXT = "Cannot use the Contains operator for numeric properties.";
var L_strDigitsNumericErr_TEXT = "Must use digits 0-9 for numeric properties.";
var L_strContainsDateErr_TEXT = "Cannot use the Contains operator for date-type properties.";
var L_strSearchForSomethingErr_TEXT = "You must specify something to search for.";
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="/bwusa/Portal/resources/searchConstants.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="/bwusa/Portal/resources/searchFunctions.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="/bwusa/Portal/resources/miscFunctions.js"></SCRIPT>
<TABLE border="0" cellpadding="0" cellspacing="0">
<FORM action="/bwusa/Portal/Search" method="post" name="publishing_SearchForm" onSubmit="return generateAndSaveSearchQueries();"> <!-- All the hidden values are here -->
<TR>
<TD>
<INPUT type="hidden" name="publishing_q_ShowAdvanced" value="true"/>
<INPUT type="hidden" name="publishing_q_WasAdvanced" value="true"/>
<INPUT type="hidden" name="publishing_q_StartResultRow" value=""/>
<INPUT type="hidden" name="publishing_q_CarriedBestBetCount" value=""/>
<INPUT type="hidden" name="publishing_qs_clause" value=""/>
<INPUT type="hidden" name="publishing_q_categories" value=""/>
<INPUT type="hidden" name="publishing_q_documents" value=""/>
<INPUT type="hidden" name="publishing_q_DateSearchUsed" value=""/>
<INPUT type="hidden" name="publishing_q_PrevCategoryKeywordConstraints" value = "" />
<INPUT type="hidden" name="publishing_q_PrevDocumentKeywordConstraints" value = "" />
<INPUT type="hidden" name="publishing_q_PrevPropertyConstraints" value = "" />
<INPUT type="hidden" name="publishing_q_SubscriptionQuery" value=""/>
<INPUT type="hidden" name="SubscribedSearch" value = "" />
<INPUT type="hidden" name="publishing_q_AutoCatEnabled" value = "true" />
<INPUT type="hidden" name="publishing_q_HiddenKeyword" value = "" />
<SELECT style="display:none" name="publishing_q_SearchScope">
<OPTION value="This site">This site</OPTION></SELECT>
<INPUT name="publishing_q_SearchKeyword" value="" size="15" maxlength="4096"/>
<INPUT style="display:none" type="submit" value=" Go " name="searchButton" />
<img src="/bwusa/portal%20content/go.gif" WIDTH="15" HEIGHT="15" />
</TD>
</TR>
</FORM>
</TABLE>
</td>
</tr>
</table>
</xsl:template>
<xsl:template name="submenu">
<table cellspacing="0" class="menu" style="visibility: hidden;">
<xsl:for-each select="SUBMENU">
<xsl:choose>
<xsl:when test="SUBMENU">
<tr class="sub" nowrap="true">
<td style="padding-left=20px" nowrap="true"><b><xsl:value-of select="TITLE" disable-output-escaping="yes" /></b></td>
<td align="right"><span class="more">4</span>
<xsl:call-template name="submenu" />
</td>
</tr>
</xsl:when>
<xsltherwise>
<tr nowrap="true">
<xsl:attribute name="href">
<xsl:value-of select="URL" />
</xsl:attribute>
<xsl:attribute name="target">_self</xsl:attribute>
<td nowrap="true" colspan="4" style="padding-left:20px;padding-right:20px"><b><xsl:value-of select="TITLE" disable-output-escaping="yes" /></b></td>
</tr>
</xsltherwise>
</xsl:choose>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>