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:

Source type:


Link rewriting scope:


Transformation of content (XSLT):

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"

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

    <xsl:variable name="aftonbladet"><form action="" 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" />
   <input name="freetext" class="textinput" type="text" value="{proxy:parameter($proxy,'VaruNr')}"/>

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

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

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

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

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!

Find us!

SiteVision AB (Headquarter)
Vasagatan 10
702 10 Orebro

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

Latest Tweets