0

Essentially my XSLT isn't up to scratch , the field is a dropdown within Contour and I get it like so:

<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

I only want the value, which is in this case "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

Any thoughts?

J

More snippets

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>
JLRishe
  • 99,490
  • 19
  • 131
  • 169
joe_peachy
  • 180
  • 2
  • 11
  • Could you show us a bit more of the XSLT? The parts before the `xsl:value-of`, for example. And if you have an example of the XML that corresponds to $records, that would be helpful too. – JLRishe Mar 07 '13 at 15:01
  • Is that _exactly_ the input XML, unmodified? The output you indicated at the top of your question seems to contain some "Id" text at the end that's not in the source XML. – JLRishe Mar 08 '13 at 08:25

1 Answers1

0

Ok, so just like with the other value, this should do the job:

<xsl:value-of select="$records//fields/*[name() = 'countryoforigin']//value"/>
JLRishe
  • 99,490
  • 19
  • 131
  • 169
  • Alas, I'm afraid not plus the other attributes e.g. position use this convention: `` - I don't see whats different with the dropdown? – joe_peachy Mar 07 '13 at 15:55
  • Could you try the modified code above? Your original XPath for the dropdown was different from the XPath for the other values. The latter have `/.//value` at the end and the former didn't. I tried to clean up the extraneous stuff in the path, but it sounds like that didn't work. Did you perhaps "clean up" the source XML you posted by deleting some namespace declarations (`xmlns="..."`)? – JLRishe Mar 08 '13 at 08:23
  • I just tried again and it worked, perhaps some sort of caching! Thanks for the help! – joe_peachy Mar 08 '13 at 14:43