简体   繁体   English

Umbraco Contour,1.1.12-选择下拉列表的值

[英]Umbraco Contour, 1.1.12 - select value of dropdown list

Essentially my XSLT isn't up to scratch , the field is a dropdown within Contour and I get it like so: 从本质上讲,我的XSLT尚不成熟,该字段是Contour中的一个下拉列表,而我得到的像这样:

<xsl:value-of select="$records//fields/child::* [name() = 'countryoforigin']"/>

however this brings back values I don't want: 但这带回了我不想要的值:

3c7607b3-714c-47ec-8863-3919c6bdcfc9dc2c66c2-fa57-4e98-b26a-89b7ed041300#country of originStringUnited Kingdomld 3c7607b3-714c-47ec-8863-3919c6bdcfc9dc2c66c2-fa57-4e98-b26a-89b7ed041300#原产国字符串英国

I only want the value, which is in this case "United Kingdom". 我只需要该值,在这种情况下为“ United Kingdom”。

Other fields that are input fields, bring back the value like so: 作为输入字段的其他字段将带回该值,如下所示:

<xsl:value-of select="$records//fields/child::* [name() = 'position']/.//value"/>

But when the same is applied to the dropdown (name ='countryoforigin') - it doesnt work 但是,当对下拉列表应用相同的名称(名称='countryoforigin')时,它将不起作用

Any thoughts? 有什么想法吗?

J Ĵ

More snippets 更多片段

XML: XML:

    <state>Approved</state>
    <created>2013-03-07T11:42:47</created>
    <updated>2013-03-07T11:42:36</updated>
    <id>325c5b27-9f0f-443b-89a2-af82bfd33356</id>
    <ip>37.152.45.58</ip>
    <pageid url="/" name="Home">1051</pageid>
    <memberkey email="" login=""></memberkey>
    <fields>
        <position record="325c5b27-9f0f-443b-89a2-af82bfd33356" sortorder="3" pageindex="0" fieldsetindex="0">
            <key>ae7f2030-1a29-4b5a-9967-2c0c939a32cb</key>
            <fieldKey>08d208c3-3c49-48ca-ac2a-5a50560a8351</fieldKey>
            <caption>#position</caption>
            <datatype>String</datatype>
            <values>
                <value><![CDATA[aM]]></value>
            </values>
        </position>
        <name record="325c5b27-9f0f-443b-89a2-af82bfd33356" sortorder="0" pageindex="0" fieldsetindex="0">
            <key>d64d51e4-b663-4279-9e5b-473d47a8751b</key>
            <fieldKey>af70f6b5-7b5c-4ac4-9643-1028a62d580a</fieldKey>
            <caption>#name</caption>
            <datatype>String</datatype>
            <values>
                <value><![CDATA[amTest4]]></value>
            </values>
        </name>
        <countryoforigin record="325c5b27-9f0f-443b-89a2-af82bfd33356" sortorder="4" pageindex="0" fieldsetindex="0">
            <key>4eb2aeaf-2b21-498f-ba38-61d20da66339</key>
            <fieldKey>dc2c66c2-fa57-4e98-b26a-89b7ed041300</fieldKey>
            <caption>#country of origin</caption>
            <datatype>String</datatype>
            <values>
                <value key="fd329420-b331-4a32-bd15-1cf2ca333c1f"><![CDATA[United Kingdom]]></value>
            </values>
        </countryoforigin>
        <sendmemail record="325c5b27-9f0f-443b-89a2-af82bfd33356" sortorder="0" pageindex="0" fieldsetindex="1">
            <key>41b02cfb-ff5b-41ff-beed-6fbfdc7ad900</key>
            <fieldKey>f81d8b63-86ea-4609-9925-f4f9ae20b82f</fieldKey>
            <caption>#send me mail</caption>
            <datatype>Bit</datatype>
            <values>
                <value><![CDATA[True]]></value>
            </values>
        </sendmemail>
        <email record="325c5b27-9f0f-443b-89a2-af82bfd33356" sortorder="2" pageindex="0" fieldsetindex="0">
            <key>7763ac53-1569-43b4-8bab-c14bb30d2874</key>
            <fieldKey>cccb1f0f-ff81-4a25-8d37-f3c7be6553f0</fieldKey>
            <caption>#email</caption>
            <datatype>String</datatype>
            <values>
                <value><![CDATA[test@test.com]]></value>
            </values>
        </email>
        <jobtitle record="325c5b27-9f0f-443b-89a2-af82bfd33356" sortorder="1" pageindex="0" fieldsetindex="0">
            <key>4a8d98bb-407a-428b-a47c-c352653f3836</key>
            <fieldKey>502ceee3-4025-41dc-a6c4-a95825f8a1fb</fieldKey>
            <caption>#job title</caption>
            <datatype>String</datatype>
            <values>
                <value><![CDATA[amTest4]]></value>
            </values>
        </jobtitle>
    </fields>
</uformrecord>

Code snippet: 程式码片段:

<xsl:param name="currentPage"/>
<xsl:param name="records" />
<table>
    <tr>
        <td width="26%">
            <font face="arial" color="#333333" size="2"><strong><xsl:value-of select="umbraco.library:GetDictionaryItem('position')"/>:</strong></font>
        </td>
        <td width="74%"><font face="arial"><xsl:value-of select="$records//fields/child::* [name() = 'position']/.//value"/></font>
        </td>
    </tr>       
</table>
<p>
      <font face="arial" color="#333333" size="2">
          <strong>
              Country of origin
              <br/>

              <xsl:value-of select="$records//fields/child::* [name() = 'countryoforigin']"/>

          </strong>
      </font>
  </p>

好的,就像其他值一样,这应该可以完成工作:

<xsl:value-of select="$records//fields/*[name() = 'countryoforigin']//value"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM