Click here to Skip to main content
15,901,426 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My project is related to tour packages. I am using .xslt for displaying the hot packages and other packages too. when i click on the package name the url should be like this

http://localhost:1090/Holiday%20Hubz%2002-02-2016%20updated%20-%20Copy/viewdetail.aspx?packid=16:1"

i want to make it user friendly. Package details coming from xslt.

XML
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" >  
  <xsl:template match="/">   
    <html>
      <body>
        <table align="left" valign="top" style="width: 100%; height: auto;" >
          <tr>


            <td colspan="3">
              <div class="ourhotoutbond">Our Domestic Packages</div>
            </td>

          </tr>
          <tr>          
          <xsl:for-each select="NewDataSet/pd ">
            <xsl:if test="position() mod 3 = 1">
             <tr></tr>              
            </xsl:if>
            <td valign="top">
              <div class="box" id="topbox2">
                <div class="special"></div>
                <xsl:variable name ="dtl" select="pack_id" />
                <xsl:variable name ="cntry" select="c_id" />
                <xsl:variable name ="pname" select="pack_name" />
                <div class="image" style="cursor:pointer">
                  <img alt='{$pname}' width="200" height="110px" OnClick = "return detail({$dtl},{$cntry});" title='{$pname}'>
                    <xsl:attribute name="src">
                      CMS_form/CMSDOC/MainImage/<xsl:value-of select="mainimage"/>
                    </xsl:attribute>                 
                  </img>
                </div>
                <!--<xsl:variable name ="dtl" select="pack_id" />
                <xsl:variable name ="cntry" select="c_id" />-->
                <div class="title">                  
                  <a href="" OnClick = "return detail({$dtl},{$cntry});">
                    <xsl:value-of select="pack_name"/>
                  </a>
                </div>
                <div class="ratings">
                  <ul class="star-rating">
                    <li>
                      <a href="#" class="one-star">1</a>
                    </li>
                    <li>
                      <a href="#" class="two-stars">2</a>
                    </li>
                    <li>
                      <a href="#" class="three-stars">3</a>
                    </li>
                    <li>
                      <a href="#" class="four-stars">4</a>
                    </li>
                    <li>
                      <a href="#" class="five-stars">5</a>
                    </li>
                  </ul>
                </div>
                <xsl:variable name="pid" select="brief_desc"/>
                <div style="display:none">
                  <div id='{$pid}'>
                    <xsl:value-of select="brief_desc" disable-output-escaping="yes"/>
                  </div>
                </div>
                <div class="desc">
                  <xsl:value-of select="Column1" disable-output-escaping="yes"/>
                  <span class="more">
                    <a href="#" onmouseover="tooltip.pop(this, '{$pid}')" OnClick = "return detail({$dtl},{$cntry});">More</a>
                  </span>
                </div>
                <div class="title">
                  <span class="count">
                    <xsl:value-of select="itday"/> Days / <xsl:value-of select="night"/> Nights
                  </span>
                  <br>
                  </br>                    
              </div>
                <div class="booknow">
                  <xsl:variable name="amt" select="price"/>
                  <xsl:if test="$amt=0">
                    <div class="price">
                      <span style="color:#772f16;">Price on Request </span>
                    </div>
                  </xsl:if>
                  <xsl:if test="$amt=''">
                    <div class="price">
                      <span style="color:#772f16;">Price on Request </span>
                    </div>
                  </xsl:if>
                  <xsl:if test="$amt!=0">
                    <div class="price">
                      <span style="color:#772f16;">
                        Rs.<xsl:value-of select="price"/>/-
                      </span>
                    </div>
                  </xsl:if>                 
                  <div class="book">
                    <xsl:variable name ="xyz" select="pack_id" />
                    <div class="cart-btn" id="selling-latest-cart-info-3" OnClick ="return request({$xyz},{$cntry});">
                      <a href="javascript:void(0)" data-bind="click: addToCart">
                        <span class="glyphicon glyphicon-shopping-cart"></span> Book Now
                      </a>
                    </div>
                  </div>
                  <div class="clear"></div>
                </div>
              </div>            
            </td>
          </xsl:for-each>          
          </tr>          
        </table>        
      </body>
    </html>
    <script language="javascript">     
      function request(td,cntry)
      {
      window.location.href='sendrequest.aspx?packid='+ td +':'+ cntry+'';
      return false;
      }
      function detail(td,cntry)
      {
      window.location.href='viewdetail.aspx?packid='+ td +':'+ cntry+'';
      return false;
      }
    </script>    
  </xsl:template>
</xsl:stylesheet>



here is my xslt data also. what changes i have to do for user friendly. IF any one can help me please I am new to this field

What I have tried:

I tried to change my ugly url to userfriendly url
Posted
Comments
F-ES Sitecore 15-Feb-16 5:22am    
Don't use folder names like "Holiday Hubz 02-02-2016 updated - Copy" and you won't have a problem.

1 solution

Hope it will work for you



[URL rewriting]

--
Thanks & Regards
Mohanavamsi
Coding Bridge
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900