I'm creating a macro that sources a property from the current member. The property uses the "multiple textstrings" datatype, and each textstring contains a media ID, the version number and the date and time added.
How can I seperate the string so I can display details from the media type? I'd like to display the preview image from media type and the nodeName of the media type.
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="contentSplit" select="umbraco.library:Split(current(), ',')" />
<xsl:template match="/">
<xsl:if test="count(umbraco.library:GetCurrentMember()/assetDownloads/values/value) > 0">
<ul>
<xsl:for-each select="umbraco.library:GetCurrentMember()/assetDownloads/values/value">
<li>
<!-- Split values via , comma using below function -->
<xsl:variable name="contentSplit" select="umbraco.library:Split(current(), ',')" />
<xsl:for-each select="$contentSplit/value">
<!-- First value as media type id -->
<xsl:if test="position() = 1">
<img>
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia(., 0)/preview" />
</xsl:attribute>
</img>
<p><xsl:value-of select="umbraco.library:GetMedia(., 0)/@nodeName" /></p>
</xsl:if>
<!-- Second value as version number -->
<xsl:if test="position() = 2">
<p>
Version: <xsl:value-of select="." />
</p>
</xsl:if>
<!-- Third value as date and time of download -->
<xsl:if test="position() = 3">
<p>
Date Time: <xsl:value-of select="." />
</p>
</xsl:if>
</xsl:for-each>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
Comma separated multiple textstrings list
I'm creating a macro that sources a property from the current member. The property uses the "multiple textstrings" datatype, and each textstring contains a media ID, the version number and the date and time added.
1475,1,28-Dec-12 01:26:45
1475,1,28-Dec-12 01:27:03
How can I seperate the string so I can display details from the media type? I'd like to display the preview image from media type and the nodeName of the media type.
Can anybody assist me with this?
Cheers, JV
Hi JV
Try this one: http://our.umbraco.org/wiki/reference/umbracolibrary/split
or this small template.
I havent tested this one yet :)
Thanks Sebastian,
I've used the following solution:
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.