As it happens, I was being stupid and not thorough - in my frantic messing with the XSLT to select appropriately (I never get it right first time!) I have the following line within the for-each:
<xsl:if test="@nodeDocumentType = BlogPost">
So, even though I had managed to alter my selection to be proper, I hadn't removed all traces of other 'modes' of selection. I'm not even sure this 'test' was itself correct (I know there is a @nodeSomethingOrOtherRelatedToType, but not sure DocumentType is it).
Flatten node hierarchy in for-each selection
Say I use the blogs package and wind up with a node hierarchy of something like this:
Blog
- DateFolder (for year)
- DateFolder (for month)
- DateFolder (for day)
- BlogPost
Then, using a custom XSLT to grab the 'latest' posts, how can I search the posts from the root node of the blog?
As usual, I have tried many permutations of selection, but as of now I have this (which I assume should only need slight alteration?):
<xsl:for-each select="umbraco.library:GetXmlNodeById(1146)/descendant::BlogPost [@isDoc and string(umbracoNaviHide) != '1']">
Hi Grant,
The XPath you're using should do exactly that (provided 1146 is the id of the Blog node and BlogPost is the DocumentType Alias of the posts).
What are you getting?
/Chriztian
I don't get anything at all. My container remains absolutely empty. (<div class="BlogContent"></div>).
As it happens, I was being stupid and not thorough - in my frantic messing with the XSLT to select appropriately (I never get it right first time!) I have the following line within the for-each:
<xsl:if test="@nodeDocumentType = BlogPost">
So, even though I had managed to alter my selection to be proper, I hadn't removed all traces of other 'modes' of selection. I'm not even sure this 'test' was itself correct (I know there is a @nodeSomethingOrOtherRelatedToType, but not sure DocumentType is it).
Just pat the idiot on the back and move on. :/
Don't worry - it happens to all of us (not really, of course - just trying to consolate :-) (no, really, it does, Ed.)
Another time, the test you tried to perform can be done with the self:: axis, like this:
/Chriztian
is working on a reply...