Your first xsl was saying on the currentPage (lets say your at home), get me all nodes of type "Packages". What you are wanting to do is find the node type "Packages" and then get me all it's child nodes (who's alias I may or may not know). Does that kind of make sense?
@isDoc is just an attribute that make sure the xml element being returned is an umbraco doc. If you omit isDoc the xsl will give you all the properties of the doc you are returning. It is required for the new xml schema.
Ahhhh.... **cue lightbulb**.. Right my understand of the Axes format was all messed up. It was saying, get me all the child nodes of the current page, that are packages, not get me all the child nodes of all the packages.
child and descendant axis doesn't seem to work correctly :/
Ok, maybe my understand of XSLT is wrong (highly likely), but here's the drama:
<xsl:apply-templates select="$currentPage//child::Packages" />
Then I have separate templates for the different child nodes:
<xsl:template match="CountryPackageCategory">...
<xsl:template match="AggregatePackageCategory">...
But the drama is, that the content from the actual Packages
node, is being dumped to the output as well.
According to: http://pimpmyxslt.com/axesviz.aspx?contextNode=1069&axis=child#screen
That shouldn't be the case?
What you are doing there is getting any child nodes of the currentPage that have the alias=Packages.
Try <xsl:apply-templates select="$currentPage/descendant::Packages [@isDoc]/descendant::* [@isDoc]" />
The above code is assuming you are running this macro from the home page.
It's hard to solve without knowing what your xml or content tree looks like.
I'm using schema 4.5 FYI. My Content Tree looks like:
I just want CountryPackage1, CountryPackage2, AggregatePackage1 - Nothing else.
The XPath you've provided fixed the initial problem I had, but it also then output the child nodes of CountryPackage1
Cool cool. Now set a level that you want to limit at, as below:
<xsl:apply-templates select="$currentPage/descendant::Packages [@isDoc]/descendant::* [@isDoc and @level = 3]" />
if you want to just select country package nodes at level 3 then use:
<xsl:apply-templates select="$currentPage/descendant::Packages [@isDoc]/descendant::countryPackage [@isDoc and @level = 3]" />
Cheers,
Neil
That works. Although I'm still not 100% clear on why my original XPath was no good :)
Also, the what does the @isDoc attribute represent?
Your first xsl was saying on the currentPage (lets say your at home), get me all nodes of type "Packages". What you are wanting to do is find the node type "Packages" and then get me all it's child nodes (who's alias I may or may not know). Does that kind of make sense?
@isDoc is just an attribute that make sure the xml element being returned is an umbraco doc. If you omit isDoc the xsl will give you all the properties of the doc you are returning. It is required for the new xml schema.
Cheers,
Neil
Ahhhh.... **cue lightbulb**.. Right my understand of the Axes format was all messed up. It was saying, get me all the child nodes of the current page, that are packages, not get me all the child nodes of all the packages.
Thanks heaps for your help!
Haha, love the ah haaa moments. Yep that's it!
No worries at all :)
Cheers,
Neil
Armed with my new found knowledge, I've updated this:
<xsl:apply-templates select="$currentPage/descendant::Packages [@isDoc]/descendant::* [@isDoc and @level = 3]" />
to:
<xsl:apply-templates select="$currentPage/descendant::Packages [@isDoc]/child::node() [@isDoc]" />
is working on a reply...