xslt - Search for a IF-ANY solution that works with <XSL:for-each> -
i searching solution following problem:
currently have code:
<div class="box"> <div class="header"> <h2>item</h2> </div> </div> <xsl:for-each select="umbraco.library:getxmlnodebyid($source)/* [name() = $documenttypealias , string(umbraconavihide) != '0']"> <xsl:if test="string(experuserid)=$currentpage/experuserid"> <xsl:value-of select="@nodename"/> <xsl:value-of select="subtitel"/> <a href="{umbraco.library:niceurl(@id)}" class="readmore"> lees meer </a> </div> </xsl:if> </xsl:for-each>
this code produces result for-each time source(experuserid) equals currentpage/experuserid.
the problem when test comes negative , there no experuserid's match currentpage. want make when occures, layout won't show. need this:
<xsl:if-any test="string(experuserid)=$currentpage/experuserid"> <div class="box"> <div class="header"> <h2>item</h2> </div> </div> <xsl:for-each select="umbraco.library:getxmlnodebyid($source)/* [name() = $documenttypealias , string(umbraconavihide) != '0']"> <xsl:if test="string(experuserid)=$currentpage/experuserid"> <xsl:value-of select="@nodename"/> <xsl:value-of select="subtitel"/> <a href="{umbraco.library:niceurl(@id)}" class="readmore"> lees meer </a> </div> </xsl:if> </xsl:for-each> <xsl:if-any>
does kind of solution exist? p.s. xslt-rookie. read using if test * so:
<xsl:if test="*string(experuserid)=$currentpage/experuserid">
but not work, help?
you want count number of matches , if there ... ...
<xsl:if test="count( child::page[experuserid = string(experuserid)] ) > 0"> <div ... blah ... /> </xsl:if>
not entirely sure "string(experuserid)" doing (apart converting textual number contained in child node called experuserid of current node string, already), present working in example i'm re-using ... have no context determine it's validity.
Comments
Post a Comment