You should be able to use the @template attribute for that - try this:
Get the ID of your "template 2" from the Settings section - hovering it's node in the Settings tree should give you its ID in the browser's statusbar - something like this:
run script openTemplate(1062); (or similar).
Then you use that in your XSLT like this:
<xsl:variable name="orgNode" select="umbraco.library:GetXmlNodeById(parentID)"/>
<xsl:variable name="templateID" select="1062" /><!-- Change the ID in this line -->
<table class="tableId">
<tr><th>Title</th></tr>
<xsl:for-each select="$orgNode/*[@isDoc][@template = $templateID]">
<xsl:sort select="@nodeName" data-type="text" order="ascending"/>
<tr>
<td>
<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
</td>
</tr>
</xsl:for-each>
</table>
How can i make it that the link would only be active if there is child nodes? If there are no child nodes, still display but make it a dead link so to speak.
Sure - you'll need to know the alias of the property using that Data Type, and then you will need to know how the values are stored. If I remember correctly, you're getting a CSV list of the checked boxes, so you'll need to use the Split() extension to get a set of value elements that you can match against, like this:
Display certain nodes
Hello,
I would like to display certain child nodes with a specific template only. My structure is like this
Parent node
Child node (template 1)
Child node (template 1)
Child node (template 1)
Child node (template 2)
Child node (template 2)
Child node (template 2)
I only want the child nodes with (template 2) to be displayed on the page.
Can anyone give me any guidance?
My xslt is as follows
Thanks for looking
Hi Gary,
You should be able to use the @template attribute for that - try this:
Get the ID of your "template 2" from the Settings section - hovering it's node in the Settings tree should give you its ID in the browser's statusbar - something like this:
run script openTemplate(1062);
(or similar).Then you use that in your XSLT like this:
/Chriztian
... Hmm, were you actually referring to the Document Type as "template"?
Let me know, and it should be easy to change, if so...
/Chriztian
Hi Chriztian,
Your solution worked perfectly!! Thank you so much for taking the time to help me with this. It's very much appreciated!!!
Fantastic!
Gary
Hi Chriztian,
thanks for your help so far.
I am using this code...
How can i make it that the link would only be active if there is child nodes? If there are no child nodes, still display but make it a dead link so to speak.
Thanks
Gary
Hi Gary,
You can actually just add an
<xsl:attribute>
override inside if necessary:- Of course you can use the
[@template = $templateID]
predicate in there too, if necessary./Chriztian
Thanks for the quick reply Chriztian.
This is great thanks.
But just to be a pain.... Do you know how i could make it so that the node still appears but has no href?
Thanks for all your help,
Gary
Hi Chriztian.
your help above is greatly appreciated and works great.
I was wondering if you could guide me a little further on this?
I am using this xslt.
I have also created a Data type that is a check box list.
Option 1 (Value 205)
Option 2 (value 206) and so on.
Do you know how i can modify the xslt to only show the nodes with a specific value (say 205)?
Thanks
Gary
Hi Gary,
Sure - you'll need to know the alias of the property using that Data Type, and then you will need to know how the values are stored. If I remember correctly, you're getting a CSV list of the checked boxes, so you'll need to use the
Split()
extension to get a set ofvalue
elements that you can match against, like this:/Chriztian
Hi Chriztian,
thank you again for your reply. the alias is 'portalOrgType' and I am using your above method like so.
although for me this isn't returning any results - no error, just no results :(
is working on a reply...