I know this can be done by using the umbracoRedirect but i rather use something like if there is a child node then jump to the child node when clicking on the parent node by using a True/false statement.
Sorry 'bout the other one - I was thinking in the way I use to do it, like I'll recommend for you here:
<!-- Only call this once -->
<xsl:variable name="sourceNode" select="umbraco.library:GetXmlNodeById($source)" />
<a>
<xsl:attribute name="href">
<xsl:choose>
<!-- If there is at least one childnode and jumpToSubpage is set -->
<xsl:when test="$sourceNode[*[@isDoc] and jumpToSubpage = 1]">
<!-- Link to the first child -->
<xsl:value-of select="umbraco.library:NiceUrl(*[@isDoc][1]/@id)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="umbraco.library:NiceUrl($sourceNode/@id)" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="$sourceNode/@nodeName" />
</a>
GetXmlNodeById to display Parent
Hi,
I have a macro which needs to be place 3 times on the same template where each of them have a different source id(folder).
Just like a basic Xslt
<xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
but my question is how do i get to display the parent node as a heading?
Hi Fuji,
Do you mean the parent of $source or the $source node itself?
The first would be:
whereas the second would be:
- but maybe that's not what you mean?
/Chriztian
Hi Chriztian,
I would like to display the nodeName of the source i choose. But I dont need to see it in my loop.
I tried both your suggestions but not working. However this works for me, but still need to get to work outside the loop
<h1><xsl:value-of select="./../@nodeName" /></h1>
//fuji
Chriztian,
I got it working this way
<xsl:value-of select="umbraco.library:GetXmlNodeById($source)/@nodeName"/>
But thanks for helping me out
Can you help me out with this chriztian,
I know this can be done by using the umbracoRedirect but i rather use something like if there is a child node then jump to the child node when clicking on the parent node by using a True/false statement.
Here is my XLST but can get it working
Hi Fuji
Not tested but hopefully correct...
Adding the [1] gets the first child node...
Let me know if it works for you.
Cheers
Nigel
Hi Fuji,
Sorry 'bout the other one - I was thinking in the way I use to do it, like I'll recommend for you here:
/Chriztian
Hi Chriztian,
Thanks for the reply. I tried it but not working when i set jumpToSubpage to True in the content node. Its giving me a parsing error
Its only the URL (link to child) which seems not to work.
//fuji
I got it working Chriztian,
Instead i changed the value from
<xsl:value-of select="umbraco.library:NiceUrl($sourceNode/*[@isDoc][1]/@id)"/>
But thanks for helping me out solving it.
Cheers
//Fuji
is working on a reply...