Help SiteVision 4

Several pages, GET and POST

This example is a simple wine guide that fetches information from Systembolaget and scores from DI and Aftonbladet.

At first the user gives a number in a form. This number should be the number that Systembolaget uses for a specific wine the user is interested in. When the form is POSTed, the information about the wine will be fetched from Systembolaget and a score for the wine is fetched from Aftonbladet via a GET. The score from DI can only be fetched via a complex form that are POSTed. This will be built as a variable in the XML template and sent. The result are parsed and the score are fetched and displayed.

Start URL:


http://www.systembolaget.se/SokDrycker/Produkt

Source type:


HTML/XHTML

Link rewriting scope:


/

Transformation of content (XSLT):


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:proxy="java:senselogic.sitevision.portlet.proxy.web.Proxy
Functions"
   extension-element-prefixes="proxy">

   <xsl:import href="template.xsl"/>

    <xsl:variable name="aftonbladet"><form action="http://www.aftonbladet.se/v3/ab/jsp/start.jsp?d=101" method="post" name="pilramsearch">

  <input type="hidden" name="maincategories" value="49,66,68,70,72" />
  <input type="hidden" name="maincountries" value="52,104,113,128,149,161,170,174,180" />

   <input type="hidden" name="a" value="17219" />
   <input type="hidden" name="action" value="search" />
   <input type="hidden" name="pilramsok" value="true" />
   <input type="hidden" name="isdrink" value="0" />
  <p>
   <input name="freetext" class="textinput" type="text" value="{proxy:parameter($proxy,'VaruNr')}"/>
  </p>
  <p>

   <input type="radio" onClick="forms&#91;'pilramsearch'&#93;&#91;'a'&#93;.value=17219;" name="pilramtype" value="wine" />
   Viner<br />
         </p>
  <p>

   <input type="image" value="Fortsätt" src="/v3/ab/road/www/department/200/images/knapp_sok.gif" />
  </p>
  </form></xsl:variable>

    <xsl:template match="/">
        <xsl:choose>
        <xsl:when test="not(proxy:parameter($proxy,'VaruNr'))">
            <form action="" method="get">
                Nr:<input type="text" name="VaruNr"/>
            </form>
       </xsl:when>
        <xsl:otherwise>
           <xsl:apply-templates select="//table[@id='ProductDetail1_tblFargDoftSmak']"/>
<p>
           <strong>DI betyg:</strong>
<xsl:apply-templates select="proxy:get($proxy,concat('http://di.se/Avdelningar/Vin.aspx?wneWineType=EasySearch&amp;wneWineSearch=',proxy:parameter($proxy,'VaruNr')))//table[@id='Contentcontainer1__ctl0_RegMainColumn_DiseWine1_TblResultList']/tr[last()]/td[last()]"/>
</p>
<p>
           <strong>Aftonbladet betyg:</strong>
<xsl:value-of select="substring(proxy:post($proxy,$aftonbladet)//table[@class='resultatTbl']//td[@class='vinplus']//img/@src,50,1)"/>
</p>
        </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template match="a[@class='text10pxfetblue']"/>
</xsl:stylesheet>

Denna sida publicerades: 2008-09-09

Skriv ut PDF-avsnitt

Hjälpte informationen på den här sidan dig?

Missa inga nya rön, tips och tricks! Prenumerera på insite!

sitevision.eu

Find us!

SiteVision AB (Headquarter)
Vasagatan 10
702 10 Orebro
Sweden

Info: +46 19-17 30 30
Support: +46 19-17 30 39

Latest Tweets