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
If imgId is empty I want get empty node set, but GetMedia return error.
How to return something like next:
<xsl:variable name="img" select="if(number($imgId), umbraco.library:GetMedia($imgId, false()), /.. /* empty node-set */ )" />
Hi,
you can assign a variable by condition like this:
<xsl:variable name="myVar">
<xsl:choose>
<xsl:when test="yourCondition">
<xsl:select .../>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Hope this helps :)
Toby
This isn't help. This return not node set as result.
for example
<xsl:variable name="img" select="umbraco.library:GetMedia($imgId, false())" />
return node set, but
<xsl:variable name="img"> <xsl:value-of select="umbraco.library:GetMedia($imgId, false())" /><xsl:variable>
doesn't return node set. The second return XML that you can parse to node set.
sorry that didn't do it! Did you try xsl:copy-of instead of xsl:value-of maybe this will do the trick:
<xsl:variable name="img"> <xsl:copy-of select="umbraco.library:GetMedia($imgId, false())" /><xsl:variable>
Cheers, Toby
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
How to return different node sets by condition?
If imgId is empty I want get empty node set, but GetMedia return error.
How to return something like next:
Hi,
you can assign a variable by condition like this:
Hope this helps :)
Toby
This isn't help. This return not node set as result.
for example
return node set, but
doesn't return node set. The second return XML that you can parse to node set.
Hi,
sorry that didn't do it! Did you try xsl:copy-of instead of xsl:value-of maybe this will do the trick:
Cheers, Toby
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.