Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Is there a way to write an XSLT if "true" statement inline in the template?
If so that would be great and how would we do it.
I want to check for true or false and tell the value to output a word like "repeat"
Example for CSS in template
background-repeat: inline XSLT goes here to output repeat if value is true if not output no-repeat if false.
Hi Carlos,
Yes this is possible, you need to insert the Type (true/false) in your documentType. Then in your XSLT somthing like
<xsl:if test="yourAlias !='1'"> background-repeat:</xs:if>
But can I do the inline XSLT?
http://our.umbraco.org/wiki/reference/templates/umbracoitem-element/inline-xslt
But using the inline XSLT true or false.
The value to be "repeat" if true and "no-repeat" if false.
I guess I would make a macro, but I don't want to make another XSLT file just for a simple true/false
You can't do <xsl:if> statements inline on a template. You can do this with Razor though as it supports inline macros.
Another way to do logic inside your template using C# and nodeFactory is shown in this post: http://our.umbraco.org/forum/templating/templates-and-document-types/15707-if-statement-on-masterpage?p=0#comment57895
-Tom
Thanks all for the input. I will just make an XSLT file to check for the true or false and output my value that way through a macro.
Hi Carlos - you can use this little trick:
<umbraco:Item field="pageID" xslt="substring('no-repeat|repeat', not($variable = 'value') * 10 + 1, 9)" runat="server" />
/Chriztian
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Inline XSLT if statement
Is there a way to write an XSLT if "true" statement inline in the template?
If so that would be great and how would we do it.
I want to check for true or false and tell the value to output a word like "repeat"
Example for CSS in template
background-repeat: inline XSLT goes here to output repeat if value is true if not output no-repeat if false.
Hi Carlos,
Yes this is possible, you need to insert the Type (true/false) in your documentType. Then in your XSLT somthing like
<xsl:if test="yourAlias !='1'"> background-repeat:</xs:if>
But can I do the inline XSLT?
http://our.umbraco.org/wiki/reference/templates/umbracoitem-element/inline-xslt
But using the inline XSLT true or false.
The value to be "repeat" if true and "no-repeat" if false.
I guess I would make a macro, but I don't want to make another XSLT file just for a simple true/false
Hi Carlos,
You can't do <xsl:if> statements inline on a template. You can do this with Razor though as it supports inline macros.
Another way to do logic inside your template using C# and nodeFactory is shown in this post: http://our.umbraco.org/forum/templating/templates-and-document-types/15707-if-statement-on-masterpage?p=0#comment57895
-Tom
Thanks all for the input. I will just make an XSLT file to check for the true or false and output my value that way through a macro.
Hi Carlos - you can use this little trick:
/Chriztian
is working on a reply...