2013-01-17 14 views
0

我正在使用單選按鈕列表,在頁面(代表城市)中選擇單選按鈕時,我需要在XSLT Sitecore中顯示城市中的單位列表。在此處我可以看到外部webservice的機構列表,所以我需要作爲城市的唯一ID(存儲爲單選按鈕的值)傳遞給webservice。下面是我用來做同樣的代碼。使用Sitecore中的單選按鈕列表XSLT

<xsl:variable name="city" select="sc:GetCityUniqueID()"/> 
    <xsl:variable name="ID" select="sc:item($city,.)" /> 
    <table cellpadding="0" cellspacing="0"> 
    <tr> 

     <td valign="top"> 
     <!--In the SiteCore Content Tree we are maintaining Institutions as Child Nodes to Cities.So using for each I am populating radio buttons with those many institutions under a city.Here Please note that I am setting Value to the ID which I need to pass to the Helpwr Function sc:GetInstitutions below--> 
     <xsl:variable name="cities" select="$content/child::item[@template='city institution details']"/> 
     <xsl:if test="$cities " > 

     <xsl:for-each select="$icities" > 
     <xsl:variable name="current" select="."></xsl:variable> 
     <input type="radio" Groupname="citylist"> 
      <xsl:attribute name="id" > 
      city<xsl:value-of select="position()"/> 
      </xsl:attribute> 
      <xsl:attribute name="name" >city</xsl:attribute> 
      <xsl:attribute name="value" > 
      <sc:text field="Institute ID" select="$current" /> 
      </xsl:attribute> 
     </input> 
     <span class="chooseCity"> 
      <sc:text field="Name" select="$current" /> 

     </span> 
     <br/> 
     </xsl:for-each> 
     </xsl:if> 
     </td> 


    </tr> 
    </table> 
    <div class="institution_results">  
     Institutions are: 
    </div> 




<div class="paddAll"> 
<!--Here 123456 should be the selected radio buttons value above,which I am passing to external webservice call done in the helper to populate Institutions--> 
    <xsl:value-of select="sc:GetInstitutions('123456’)" disable-output-escaping="yes"/> 

    </div> 

我面對這裏的問題是我怎麼能選擇的單選按鈕值傳遞給XSL助手功能得到機構的名單,並顯示如下頁面的結果。

任何建議將有幫助。

回答

0

我對SiteCore並不熟悉,但this blog建議通過sc:fld()函數訪問字段值,而this blog似乎有通過參數訪問SiteCore字段的說明。你有沒有嘗試過這些方法?

一旦你成功地獲得價值到XSLT(假設參數或變量名稱「城市」在這裏),我想你應該能夠使用這樣的,假設sc:GetInstitutions()功能確實存在:

<xsl:value-of select="sc:GetInstitutions($city)" disable-output-escaping="yes"/> 
1

在我看來,你正在嘗試做一些很難在XSLT中完成的事情,並且可以通過在dropdownlist-change-event中使用帶有回發事件的SubLayout(ASCX)輕鬆完成,而不是使用呈現(XSLT ),其中你沒有像回發一樣的東西。 渲染主要用於顯示簡單的文本和列表,沒有花哨的東西。 如果你想在xslt中堅持這樣做,你可以使用jQuery AJAX來實現這一點,但我建議改變SubLayout的渲染。