Xsl trick

Topics: General, XSLT
Apr 28, 2011 at 8:43 AM

Hi guys,

I admit that I'm no good with Xsl (yet). I had a post on here earlier this week in regards to getting additional information added to SitemapXml output which I eventually got working.

My aim now is to return, from this list, only the nodes that sit under the current selected page, which contains an additional flag. I've tried:

<xsl:param name="sitemap" select="/in:inputs/in:result[@name='SitemapXml']/Page" />

<xsl:if test="$sitemap[@Tabbed='true']">
    <!-- do stuff here -->

Which seems to be working fine, but I need nodes to be returned situated under the current page. After reading through a couple of threads on here, I noticed a method called "ChildrenXml" but I can't seem to get this to work. Is this a custom method that needs to be built or how would I use this in my given scenario?



Apr 28, 2011 at 10:47 AM
Edited Apr 28, 2011 at 10:47 AM

if you need to select "pages that are under current page and has @Tabbed="true", that would be something like:

<xsl:variable name="CurrentPage" select="/in:inputs/in:result[@name='SitemapXml']/descendant::Page[@iscurrent='true']" />

<xsl:variable name="Tabs" select="$CurrentPage/Page[@Tabbed ='true']" />


Apr 28, 2011 at 1:40 PM

Thanks @napernik

Will give this a try, kind of helps me with another question I had.

Apr 28, 2011 at 3:39 PM

Hello, I used a scoped call to SitemapXml which I called ChildrenXml in my function described in another thread.

In the function designer, add a Function Call to SitemapXml, and select the Page Scope parameter for modification. Click "Constant" and a drop-down full of parameter values will appear, one of which says "Child pages" and limits scope to children of the current page (it appears). Then, I gave my function call to sitemap xml a local name, "ChildrenXml" (select the function in the list of function calls to expose this).