how do I pass url parameter to xsl using javascript?

I am trying to pass a url parameter to an xsl doc so that I can use that variable as a search and sort value for the transformation of an xsl doc.  I am using php and have implemented a solution using sarissa, but it does not work in Safari and Opera.  I need a simple solution that works for all browsers.
jzilberbergAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jzilberbergAuthor Commented:
Ok, got this all worked out.  It is really much simpler than it is made out to be when using PHP.  See my code snippet.
<?php
 
$xmlDoc = new DOMDocument;
$xmlDoc->load('xml/recipes.xml');
 
$xsl = new DOMDocument();
$proc = new XSLTProcessor;
$proc->setParameter( '', 'sort', $_GET['sort']);
$proc->setParameter( '', 'order', $_GET['order']);
$proc->setParameter( '', 'records_start', $_GET['records_start']);
$proc->setParameter( '', 'records_end', $_GET['records_end']);
$xsl->load('xml/recipes.xsl');	
$proc->importStyleSheet($xsl);
 
//This next line is the output to browser so it can be put anywhere in the html.
$proc->transformToXML($xmlDoc);
 
?>

Open in new window

0
jzilberbergAuthor Commented:
And her is the xsl.
<?xml version="1.0" encoding="ISO-8859-1"?>
 
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
<xsl:param name="sort"/>
<xsl:param name="order"/>
<xsl:param name="records_start"/>
<xsl:param name="records_end"/>
 
<xsl:template match="/">
 
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <th align="center" class="table_header" nowrap="nowrap"><a href="recipes_list.php?sort=name" class="link_white">Name</a></th>
      <th align="center" class="table_header" nowrap="nowrap"><a href="recipes_list.php?sort=type" class="link_white">Type</a></th>
      <th align="center" class="table_header" nowrap="nowrap"><a href="recipes_list.php?sort=venue" class="link_white">Venue</a></th>
      <th align="center" class="table_header" nowrap="nowrap"><a href="recipes_list.php?sort=lowfat" class="link_white">Low Fat</a></th>
      <th align="center" class="table_header" nowrap="nowrap"><a href="recipes_list.php?sort=quick" class="link_white">Quick</a></th>
      <th align="center" class="table_header" nowrap="nowrap"><a href="recipes_list.php?sort=new" class="link_white">New</a> </th>
      <th align="center" class="table_header_right" nowrap="nowrap"><a href="recipes_list.php?sort=featured" class="link_white">Featured</a></th>
    </tr>
    <xsl:for-each select="recipes/recipe">
        <xsl:sort select="(*|*/*)[name() = $sort]" order="{$order}"/>
        <xsl:if test="position() &gt;= $records_start and position() &lt;= $records_end">
            <xsl:choose>
                  <xsl:when test="position() mod 2">
                    <tr>
                      <td class="table_text" valign="top"><a href="recipes_item.php?id={id}"><xsl:value-of select="name"/></a></td>
                      <td class="table_text" valign="top" nowrap="nowrap"><xsl:value-of select="type"/></td>
                      <td class="table_text" valign="top" nowrap="nowrap"><xsl:value-of select="venue"/></td>
                      <td class="table_text" valign="top" align="center"><xsl:value-of select="lowfat"/></td>
                      <td class="table_text" valign="top" align="center"><xsl:value-of select="quick"/></td>
                      <td class="table_text" valign="top" align="center"><xsl:value-of select="new"/></td>
                      <td class="table_text_right" valign="top" align="center"><xsl:value-of select="featured"/></td>
                    </tr>
                </xsl:when>
                <xsl:otherwise>
                    <tr style="background-color: #CCCCCC;">
                      <td class="table_text" valign="top"><a href="recipes_item.php?id={id}"><xsl:value-of select="name"/></a></td>
                      <td class="table_text" valign="top" nowrap="nowrap"><xsl:value-of select="type"/></td>
                      <td class="table_text" valign="top" nowrap="nowrap"><xsl:value-of select="venue"/></td>
                      <td class="table_text" valign="top" align="center"><xsl:value-of select="lowfat"/></td>
                      <td class="table_text" valign="top" align="center"><xsl:value-of select="quick"/></td>
                      <td class="table_text" valign="top" align="center"><xsl:value-of select="new"/></td>
                      <td class="table_text_right" valign="top" align="center"><xsl:value-of select="featured"/></td>
                    </tr>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:if>
    </xsl:for-each>
    </table>
 
</xsl:template>
</xsl:stylesheet>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
waaromiknietCommented:
In this line:

<xsl:sort select="(*|*/*)[name() = $sort]" order="{$order}"/>

What does (*|*/*) mean?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.