0

ページ内のラジオ ボタン (都市を表す) を選択すると、XSLT Sitecore で都市の機関のリストを表示する必要があるラジオ ボタン リストに取り組んでいます。ここでは、外部 Web サービスから機関のリストを取得するので、都市の一意の ID (ラジオ ボタンの値として保存される) として Web サービスに渡す必要があります。以下は、同じことをするために使用しているコードです。

  <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 ヘルパー関数に渡して機関のリストを取得し、その結果を下の同じページに表示する方法です。

どんな提案も役に立ちます。

4

2 に答える 2

1

XSLTで達成するのが難しく、dropdownlist-change-eventのpostbackイベントでSubLayout(ASCX)を使用することで、レンダリング(XSLT)を使用する代わりに、簡単に実行できることを実行しようとしているようです。ポストバックのようなものはありません。レンダリングは、主に単純なテキストとリストを表示するために使用され、派手なものは使用されません。xsltでこれを継続したい場合は、jQuery AJAXを使用してこれを実現できますが、SubLayoutのこのレンダリングを変更することをお勧めします。

于 2013-01-17T08:51:43.287 に答える
0

私は SiteCore に詳しくありませんが、このブログsc:fld()では関数を介してフィールド値にアクセスすることが提案されており、このブログではパラメーターを介して SiteCore フィールドにアクセスする方法が説明されているようです。これらのアプローチのいずれかを試しましたか?

XSLT に値を正常に取得したら (ここではパラメーターまたは変数名が "city" であると仮定します)、sc:GetInstitutions()関数が実際に存在すると仮定すると、次のように使用できるはずです。

<xsl:value-of select="sc:GetInstitutions($city)" disable-output-escaping="yes"/>
于 2013-01-17T04:46:29.497 に答える