Yes you´re right version 4.0.2.1 use the old schema and from version 4.5 and further use the new schema per default.
In your case this should work. I must say I don´t have spend so must time with the old schema, because I have implemented solutions on Umbraco 4.5 and newer. So I only use the old schema in a short periode of time.
<xsl:choose> <xsl:when test="$media !='' and $link !='')"> <xsl:for-each select="$listingPage/node"> <li> <xsl:variable name="url" select="$media[@alias = 'umbracoFile']" /> </li> </xsl:for-each> </xsl:when> <xsl:otherwise> <!-- Do some other stuff--> </xsl:otherwise> </xsl:choose>
By using the normalize-space as Chrizitan said you removes leading and trailing spaces from the specified string, and replaces all internal sequences of white space with one and returns the result. If there is no string argument it does the same on the current nod.
Dennis, even if I got your rendering I fear it would be the same link and icon for every node found in my loop - Wouldn't I need both variables inside the foreach loop then use the "current()", like:
Anyway I don't normally use a U version this old either so I ended up making both fields mandatory which means if a node is found they are both always there.
XSLT - if x and b not null then creating list item
<xsl:variable name="media" select="umbraco.library:GetMedia($listingPage/node/data[@alias = 'icon'], 0)/data" />
<xsl:variable name="link" select="umbraco.library:GetMedia($listingPage/node/data[@alias = 'contentLink'], 0)/data" />
<xsl:for-each select="$listingPage/node">
<xsl:choose>
<xsl:when test="($media !='') and ($link !='')">
<li>
<xsl:variable name="url" select="$media[@alias = 'umbracoFile']" />
........................................
All I want to do is check that each child node of $listingPage has something set for both $media and $link properties.
Hi Liam,
Which version of Umbraco are you using.
Looking forward to hear from you.
/Dennis
Hi Dennis,
Version 4.0.2.1 so the old schema?
Cheers/
Liam
Hi Liam,
You can include those criteria in the for-each so you're only processing items that have values in those properties:
/Chriztian
Yes you´re right version 4.0.2.1 use the old schema and from version 4.5 and further use the new schema per default.
In your case this should work. I must say I don´t have spend so must time with the old schema, because I have implemented solutions on Umbraco 4.5 and newer. So I only use the old schema in a short periode of time.
By using the normalize-space as Chrizitan said you removes leading and trailing spaces from the specified string, and replaces all internal sequences of white space with one and returns the result. If there is no string argument it does the same on the current nod.
Hope this helps.
/Dennis
Hi,
Sorry guys, tried both suggestions with no joy.
Dennis, even if I got your rendering I fear it would be the same link and icon for every node found in my loop - Wouldn't I need both variables inside the foreach loop then use the "current()", like:
<xsl:for-each select="$listingPage/node">
<xsl:variable name="media" select="umbraco.library:GetMedia(current()/data[@alias = 'icon'], 0)/data" />
<xsl:variable name="link" select="umbraco.library:NiceUrl(current()/data[@alias= 'contentLink'])" />
Anyway I don't normally use a U version this old either so I ended up making both fields mandatory which means if a node is found they are both always there.
Thanks for the help everyone.
Cheers.
Liam
is working on a reply...