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
hello.
I have a news list that i wont to display. I would like to sjow only the ones that has a certain value in a custom property that i made in my document type. I have something like this:
<xsl:template match="/"> <div class="newsList"> <xsl:for-each select="$currentPage/data[@alias = 'itemName']"> <xsl:sort select="@updateDate" order="ascending" /> <h3 class="headline"> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </h3> <small class="meta">Posted: <xsl:value-of select="umbraco.library:LongDate(@updateDate, true(), ' - ')"/></small><br/> <p class="introduction"> <xsl:value-of select="umbraco.library:ReplaceLineBreaks(introduction)" disable-output-escaping="yes"/> </p> </xsl:for-each> </div> </xsl:template>
Hope that you guys are able to help
Thanks
Hi Klaus,
There are basically three ways to filter nodes based on one of their properties:
1. Checking for a certain value, e.g. finding all hidden pages:
<xsl:apply-templates select="$currentPage/*[umbracoNaviHide = 1]"/>
2. Checking that something is not a specific value, e.g. all non-hidden pages:
<xsl:apply-templates select="$currentPage/*[umbracoNaviHide != 1]"/>
3. Checking if a property has any content at all — the normalize-space() function is your friend here:
<xsl:apply-templates select="$currentPage/*[normalize-space(description)]"/>
When used in a predicate, the normalize-space() function returns true if there is any text content in the tested element, after trimming whitespace. I've explained it in more detail here and Chriztian explains it even better here.
Will that work for your purposes?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Returning a doc with a specific attribute value
hello.
I have a news list that i wont to display. I would like to sjow only the ones that has a certain value in a custom property that i made in my document type. I have something like this:
Hope that you guys are able to help
Thanks
Hi Klaus,
There are basically three ways to filter nodes based on one of their properties:
1. Checking for a certain value, e.g. finding all hidden pages:
2. Checking that something is not a specific value, e.g. all non-hidden pages:
3. Checking if a property has any content at all — the normalize-space() function is your friend here:
When used in a predicate, the normalize-space() function returns true if there is any text content in the tested element, after trimming whitespace. I've explained it in more detail here and Chriztian explains it even better here.
Will that work for your purposes?
is working on a reply...