Syntax for getting and using a document type property in 4.5 XML Schema
Hi everyone, new to Umbraco + Forum + XSLT ! Loving it so far.
I am a bit stuck with trying to achieve the following:
I have a document type where a user can, in the Content area, use a custom datatype (radio buttons) to select either 'valueA' or 'valueB' or 'valueC'.
In a XSLT file I would like to store a reference to the property name and then test its value to alter html output. For example:
$myProperty = Document Type Property Name
and later on in the code:
If $myProperty = 'valueA' then output this html, else if $myProperty = 'valueB' then output this html etc...
Please could someone help with sample syntax - I have seen the example in the Documentation about getting a document type property using the new XML Schema but found it too confusing.
I think there is another datatype that is called something like "Dropdown (publish values)", which will save the text instead of the id to the property field.
Syntax for getting and using a document type property in 4.5 XML Schema
Hi everyone, new to Umbraco + Forum + XSLT ! Loving it so far.
I am a bit stuck with trying to achieve the following:
I have a document type where a user can, in the Content area, use a custom datatype (radio buttons) to select either 'valueA' or 'valueB' or 'valueC'.
In a XSLT file I would like to store a reference to the property name and then test its value to alter html output. For example:
$myProperty = Document Type Property Name
and later on in the code:
If $myProperty = 'valueA' then output this html, else if $myProperty = 'valueB' then output this html etc...
Please could someone help with sample syntax - I have seen the example in the Documentation about getting a document type property using the new XML Schema but found it too confusing.
Something like this?
Yes just like that, thankyou Morten!
I think I am missing just one thing. My Datatype settings look like this
Text Value
---------- -----------
ValueA 5
ValueB 6
Using your code, $myProperty = '5' displays "Value was A"
but $myProperty = 'ValueA' displays "Value was something else".
Is there a setting I can change under the Datatype so your code matches the text instead of the number?
Thanks
James
I think this would do that:
Haven't tested it, but try it out.
I tried it but no luck. I will keep trying things out :)
Thanks for making the main syntax clear, very much appreciated
I think there is another datatype that is called something like "Dropdown (publish values)", which will save the text instead of the id to the property field.
Yes, following your advice I changed the datatype to 'Dropdown List' and now it matches the text!
is working on a reply...