Im having trouble listing out the subpages of this specific node (Quotes & Testimonials). I want to embed this list into my master template using a maco. Below is a screenshot of my File Tree. You can see that I have 4 child pages that I am wanting to show listed.
You can see my current XSLT code below.. The alias for the doctype that I am trying to target is "QuotesTestimonials" however I guess I wouldn't mind setting it to the specific node id 1789 either
In your example "1789" was the same thing as "QuotesTestimonials" so I needed to list the docType of the child pages which was "NewQuote" and now we are all set. Thanks. Im sure I'll be using this a lot.
The approach by Rich is working for you and that is of course great.
But I believe that it should also be possible to achieve using an apply-template so there is no need to use the GetXmlNodeById extension and no need for the for-each loop as well.
depends where the macro is placed...doesn't it? :-) (Maybe I misunderstand but the notion I got from the initial post was that this was intended to be placed on the frontpage of the site - then it should work).
But to make sure this will work independent of where the macro is placed it's of course better to use the root node as the starting point.
I assumed FFC needed it to work from all pages, either way your last solution is much nicer as it doesn't rely on hardcoding the node id :) (though it does rely on the structure staying the same)
Yes you have a very good point with that and I tried playing around with it since I'm pretty sure it should be possible to simply just match the DocumentType/Element in the XSLT so it's independent of the structure...but when I was trying I made my browser crash...so probably did something wrong :D
But I will keep trying and post it in here as soon as I figure out how to.
List subpages of specific DocType - XSLT
Im having trouble listing out the subpages of this specific node (Quotes & Testimonials). I want to embed this list into my master template using a maco. Below is a screenshot of my File Tree. You can see that I have 4 child pages that I am wanting to show listed.
You can see my current XSLT code below.. The alias for the doctype that I am trying to target is "QuotesTestimonials" however I guess I wouldn't mind setting it to the specific node id 1789 either
You can use GetXmlNodeById
Rich
@Rich - Thanks! I had to change it a little but that was a better way to go about it.
In your example "1789" was the same thing as "QuotesTestimonials" so I needed to list the docType of the child pages which was "NewQuote" and now we are all set. Thanks. Im sure I'll be using this a lot.
HI FFC
The approach by Rich is working for you and that is of course great.
But I believe that it should also be possible to achieve using an apply-template so there is no need to use the GetXmlNodeById extension and no need for the for-each loop as well.
You should be able to do something like this...
<ul>
<xsl:apply-templates select="$currentPage/ListsAlias/QuotesTestimonials/*[@isDoc]" />
</ul>
</xsl:template>
<xsl:template match="TheAliasOfTheBelowTheQuotesBranch">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:template>
Just an alternative suggestion :-)
/Jan
Hey Jan,
I'm not sure that's going to work using the currentPage?
Rich
Hi Rich
depends where the macro is placed...doesn't it? :-) (Maybe I misunderstand but the notion I got from the initial post was that this was intended to be placed on the frontpage of the site - then it should work).
But to make sure this will work independent of where the macro is placed it's of course better to use the root node as the starting point.
Then the sample should look like this
<xsl:variable name="root" select="$currentPage/ancestor-or-self::* [@isDoc][@level=1]" />
<ul>
<xsl:apply-templates select="$root/ListsAlias/QuotesTestimonials/*[@isDoc]" />
</ul>
</xsl:template>
<xsl:template match="TheAliasOfTheBelowTheQuotesBranch">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:template>
/Jan
Hey Jan,
I assumed FFC needed it to work from all pages, either way your last solution is much nicer as it doesn't rely on hardcoding the node id :) (though it does rely on the structure staying the same)
Rich
Hi Rich
Yes you have a very good point with that and I tried playing around with it since I'm pretty sure it should be possible to simply just match the DocumentType/Element in the XSLT so it's independent of the structure...but when I was trying I made my browser crash...so probably did something wrong :D
But I will keep trying and post it in here as soon as I figure out how to.
Cheers.
/Jan
How do i make a list of other document types except 1 any xslt code examples wil be very useful
is working on a reply...