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 everybody, i want to make a foreach inside a foreach.
<xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']"> <h2 class="presentation-headline"><xsl:value-of select="praesentationsTitel"/></h2> <img class="presentation-img" align="right"> <xsl:attribute name="src"> <xsl:value-of select="praesentationsBillede"/> </xsl:attribute> </img> <ul class="presentation-list"> <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/*/*"> <li><xsl:value-of select="@nodeName"/></li> </xsl:for-each> </ul></xsl:for-each>
This is ofcorse because of /*/* selecting ALL the children notes from all the notes.
I want an xpath something like this:
umbraco.library:GetXmlNodeById($source)/[select current foreach item]/*
Hi Matias,
Inside the "select" for your second (nested) for-each loop, you don't need the "umbraco.library:GetXmlNodeById" function.
Try this instead:
<xsl:for-each select="umbraco.library:GetXmlNodeById($source)/*[@isDoc and string(umbracoNaviHide) != '1']"> <h2 class="presentation-headline"><xsl:value-of select="praesentationsTitel"/></h2> <img class="presentation-img" align="right"> <xsl:attribute name="src"> <xsl:value-of select="praesentationsBillede"/> </xsl:attribute> </img> <ul class="presentation-list"> <xsl:for-each select="*[@isDoc and string(umbracoNaviHide) != '1']"> <li><xsl:value-of select="@nodeName"/></li> </xsl:for-each> </ul> </xsl:for-each>
Cheers, Lee.
thank you, didn't knew you could "continue" xpath with an * :) nice thanks you.
Yes, once you are inside the for-each loop, you have the context of the current node... so any XPath used will be applied against that. :-)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Foreach inside foreach
Hello everybody, i want to make a foreach inside a foreach.
<xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
<h2 class="presentation-headline"><xsl:value-of select="praesentationsTitel"/></h2>
<img class="presentation-img" align="right">
<xsl:attribute name="src">
<xsl:value-of select="praesentationsBillede"/>
</xsl:attribute>
</img>
<ul class="presentation-list">
<xsl:for-each select="umbraco.library:GetXmlNodeById($source)/*/*">
<li><xsl:value-of select="@nodeName"/></li>
</xsl:for-each>
</ul>
</xsl:for-each>
This is ofcorse because of /*/* selecting ALL the children notes from all the notes.
I want an xpath something like this:
umbraco.library:GetXmlNodeById($source)/[select current foreach item]/*
Hi Matias,
Inside the "select" for your second (nested) for-each loop, you don't need the "umbraco.library:GetXmlNodeById" function.
Try this instead:
Cheers, Lee.
thank you, didn't knew you could "continue" xpath with an * :) nice thanks you.
Hi Matias,
Yes, once you are inside the for-each loop, you have the context of the current node... so any XPath used will be applied against that. :-)
Cheers, Lee.
is working on a reply...