I'm creating a dynamic site that uses one ASP.NET page (index.aspx) to pull data from XML/XSLT/CSS to create webpages dynamically. Some of the properties are passed through the QueryString.
I'm wanting to store a literal value within a default variable which is to be placed within every XSLT stylesheet for my dynamic site. I want this because I'd like to keep uniformity for a full path that will be called from several pages within the same page.
For my example page, here are the results for the QueryString values:
page=formsdocs
dir=onlineservices
subdir1=formsdocs
subdir2=N/A
subLeftnav=true
tableStatus=true
sortBy=title
sortType=text
sortOrder=ascending
...and the value for the $mainpath variable is: <!-- m --><a class="postlink" href="http://SERVER/DIRECTORY/index.aspx">http://SERVER/DIRECTORY/index.aspx</a><!-- m -->.
This is what I have so far:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml" encoding="UTF-8" indent="yes"/>
<!-- Default variables -->
<xsl:variable name="mainpath">http://SERVER/DIRECTORY/index.aspx?</xsl:variable>
<xsl:variable name="fullpath">{$mainpath}page={@id}#38;dir={dir_code}#38;subdir1={subdir1_code}#38;subdir2={subdir2_code}#38;subLe ftnav={subLeftnav}#38;tableStatus={tableStatus}#38;sortBy={sortBy}#38;sortType={sortType}#38;sortOrd er={sortOrder}</xsl:variable>
<xsl:variable name="il_onlineservices" select="document('http://SERVER/DIRECTORY/SUBDIR/docs/xml/internal_links.xml')" />
<xsl:template match="/">
<xsl:for-each select="$il_onlineservices/internal_links/page">
<xsl:if test="@id = 'formsdocs'">
<a class="small" href=http://www.webdeveloper.com/forum/archive/index.php/"{$fullpath}">more Forms #38; Documents...</a><!-- <<<THIS IS WHERE I WANT IT DISPLAYED WITHIN THE HREF PROPERTY -->
</xsl:if>
</xsl:for-each>
The resulting value is this:
{$mainpath}page={@id}&dir={dir_code}&subdir1={subdir1_code}&subdir2={subdir2_code}&subLeftnav={subLeftnav}&tableStatus={tableStatus}&sortBy={sortBy}&sortType={sortType}&sortOrder={sortOrder}
...but I want it to be this:
<!-- m --><a class="postlink" href="http://SERVER/DIRECTORY/index.aspx?page=formsdocs&dir=onlineservices&subdir1=formsdocs&subdir2=&subLeftnav=true&tableStatus=true&sortBy=title&sortType=text&sortOrder=ascending">http://SERVER/DIRECTORY/index.aspx?page ... =ascending</a><!-- m -->
I've also tried placing the variable within the template itself, and changing it to a parameter like this:
<xslaram name="fullpath" select="{$mainpath}page={@id}#38;dir={dir_code}#38;subdir1={subdir1_code}#38;subdir2={subdir2_code}#38;subLe ftnav={subLeftnav}#38;tableStatus={tableStatus}#38;sortBy={sortBy}#38;sortType={sortType}#38;sortOrd er={sortOrder}" />
...but the result was exactly the same. How can I accomplish this? Thanks for any help.
I'm wanting to store a literal value within a default variable which is to be placed within every XSLT stylesheet for my dynamic site. I want this because I'd like to keep uniformity for a full path that will be called from several pages within the same page.
For my example page, here are the results for the QueryString values:
page=formsdocs
dir=onlineservices
subdir1=formsdocs
subdir2=N/A
subLeftnav=true
tableStatus=true
sortBy=title
sortType=text
sortOrder=ascending
...and the value for the $mainpath variable is: <!-- m --><a class="postlink" href="http://SERVER/DIRECTORY/index.aspx">http://SERVER/DIRECTORY/index.aspx</a><!-- m -->.
This is what I have so far:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml" encoding="UTF-8" indent="yes"/>
<!-- Default variables -->
<xsl:variable name="mainpath">http://SERVER/DIRECTORY/index.aspx?</xsl:variable>
<xsl:variable name="fullpath">{$mainpath}page={@id}#38;dir={dir_code}#38;subdir1={subdir1_code}#38;subdir2={subdir2_code}#38;subLe ftnav={subLeftnav}#38;tableStatus={tableStatus}#38;sortBy={sortBy}#38;sortType={sortType}#38;sortOrd er={sortOrder}</xsl:variable>
<xsl:variable name="il_onlineservices" select="document('http://SERVER/DIRECTORY/SUBDIR/docs/xml/internal_links.xml')" />
<xsl:template match="/">
<xsl:for-each select="$il_onlineservices/internal_links/page">
<xsl:if test="@id = 'formsdocs'">
<a class="small" href=http://www.webdeveloper.com/forum/archive/index.php/"{$fullpath}">more Forms #38; Documents...</a><!-- <<<THIS IS WHERE I WANT IT DISPLAYED WITHIN THE HREF PROPERTY -->
</xsl:if>
</xsl:for-each>
The resulting value is this:
{$mainpath}page={@id}&dir={dir_code}&subdir1={subdir1_code}&subdir2={subdir2_code}&subLeftnav={subLeftnav}&tableStatus={tableStatus}&sortBy={sortBy}&sortType={sortType}&sortOrder={sortOrder}
...but I want it to be this:
<!-- m --><a class="postlink" href="http://SERVER/DIRECTORY/index.aspx?page=formsdocs&dir=onlineservices&subdir1=formsdocs&subdir2=&subLeftnav=true&tableStatus=true&sortBy=title&sortType=text&sortOrder=ascending">http://SERVER/DIRECTORY/index.aspx?page ... =ascending</a><!-- m -->
I've also tried placing the variable within the template itself, and changing it to a parameter like this:
<xslaram name="fullpath" select="{$mainpath}page={@id}#38;dir={dir_code}#38;subdir1={subdir1_code}#38;subdir2={subdir2_code}#38;subLe ftnav={subLeftnav}#38;tableStatus={tableStatus}#38;sortBy={sortBy}#38;sortType={sortType}#38;sortOrd er={sortOrder}" />
...but the result was exactly the same. How can I accomplish this? Thanks for any help.