0

本质上我的 XSLT 没有达到标准,该字段是 Contour 中的一个下拉列表,我得到它是这样的:

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

但是,这会带回我不想要的值:

3c7607b3-714c-47ec-8863-3919c6bdcfc9dc2c66c2-fa57-4e98-b26a-89b7ed041300#country of originStringUnited Kingdomld

我只想要这个值,在这种情况下是“英国”。

作为输入字段的其他字段,像这样带回值:

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

但是当相同的应用于下拉列表时(名称='countryoforigin') - 它不起作用

有什么想法吗?

Ĵ

更多片段

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>

代码片段:

<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>
4

1 回答 1

0

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

<xsl:value-of select="$records//fields/*[name() = 'countryoforigin']//value"/>
于 2013-03-07T15:36:08.917 回答