Cleanest way to get simple document type value on page
Hi,
On one of my document types I'm letting the user select a theme colour. This is done by having a colorPicker datatype with the alias 'primaryColour' on the document type. I've created a macro to embed a bit of CSS into the head of any page which has a value set for 'primaryColour'. This must be a really silly question, but I just want to grab the value of 'primaryColour' in the macro - can I do it without a 'for-each' loop in there? I was hoping to do something like this, but it doesn't seem to return a value when there is one:
Forgot to mention that I think you should write this
<xsl:variable name="primaryColour" select="$currentPage/data [@alias = 'primaryColour']" /> since I guess you'll need the value from the current page, right?
Cleanest way to get simple document type value on page
Hi,
On one of my document types I'm letting the user select a theme colour. This is done by having a colorPicker datatype with the alias 'primaryColour' on the document type. I've created a macro to embed a bit of CSS into the head of any page which has a value set for 'primaryColour'. This must be a really silly question, but I just want to grab the value of 'primaryColour' in the macro - can I do it without a 'for-each' loop in there? I was hoping to do something like this, but it doesn't seem to return a value when there is one:
Thanks all
Hi Dan
Which datatype have you selected to handle the color selection?
I think you should be using the $currentPage parameter solution. If you have been using the dropdown list you'll get the name for the selected color.
/Jan
Forgot to mention that I think you should write this
<xsl:variable name="primaryColour" select="$currentPage/data [@alias = 'primaryColour']" /> since I guess you'll need the value from the current page, right?
Hi Dan,
Me thinks it should be:
<xsl:variable name="primaryColour" select="string($currentPage/data[@alias='primaryColour'])"/>
Cheers,
/Dirk
Bingo, thanks Jan - it was the /node which needed to be /data.
is working on a reply...