It does make sense if there's an element(UtilityLinks) between the root-element($currentPage) and the UtilityLink-element. The following examples would probably work as well I think:
So, when you're on the Homepage of your site, that's what $currentPage will be, the Homepage.
From there you want to go down the content tree, through the UtilityLinks node to all the UtilityLink nodes. That is, $currentPage/UtilityLinks/*
If you want to simply look for all the UtilityLink nodes you could do any of the following which are all basically equivalent:
$currentPage/descendent::*[name()='UtilityLink']
$currentPage//*[name()='UtilityLink']
$currentPage//UtilityLink
Of course, descendent-or-self (the short-hand is '//') is slower than specifying the full path but unless you've got a boat load of nodes you're unlikely to notice it. Still, keep it in mind; you want to specify as much as you can to get maximum performance.
Thanks Doug, it makes total sense now. Unless we have a HUGE site, I typically want to be as "unspecific" as possible in case the structure of the content changes. In this case though, it's a matter of being rusty :)
XPath Filtering not working
This is a strange one that I've never seen before. The following returns nothing for me:
But this does:
What gives? Thanks!
Ps. I'm sure it must be something dumb that I am just missing after having looked at it for a few hours.
Let's start at step zero... what's the (simplified) output of:
Basically, I want to see the xml you have to work with. Likewise, what's the content tree you see? Obviously they should coincide completely, do they?
cheers,
doug.
Hi Nik
It does make sense if there's an element(UtilityLinks) between the root-element($currentPage) and the UtilityLink-element. The following examples would probably work as well I think:
Either way, I'd probably use the solution you provided in your first post anyway :)
/Kim A
Sweet, I have THE man looking at this. Cool :)
So, here's my output fom copy-of (rather long)
<Homepage id="1053" parentID="-1" level="1" writerID="0" creatorID="0" nodeType="1049" template="1050" sortOrder="2" createDate="2011-06-28T13:51:31" updateDate="2011-06-28T23:58:42" nodeName="Homepage (en)" urlName="homepage-(en)" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053" isDoc=""> <browserTitle>Homepage</browserTitle> <metaKeywords>online,account,opening</metaKeywords> <metaDescription>Nations leading provider of online account opening</metaDescription> <siteName>Andera Inc.</siteName> <Overview id="1069" parentID="1053" level="2" writerID="0" creatorID="0" nodeType="1063" template="1052" sortOrder="1" createDate="2011-06-28T15:04:38" updateDate="2011-06-28T23:58:42" nodeName="Solutions" urlName="solutions" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1069" isDoc=""> <pageTitle /> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview /> <bodyText></bodyText> <productIconTopNav /> <productIconNav /> <productSpecSheet /> <browserTitle>Solutions</browserTitle> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground>1179</sectionBackground> <backgroundColor>ced54b</backgroundColor> <Textpage id="1082" parentID="1069" level="3" writerID="0" creatorID="0" nodeType="1056" template="1047" sortOrder="1" createDate="2011-06-28T16:14:01" updateDate="2011-06-28T23:58:42" nodeName="Account Opening" urlName="account-opening" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1069,1082" isDoc=""> <pageTitle>Account Opening</pageTitle> <introText> <p>this is the intro text</p> </introText> <showIntroTextOnPage>1</showIntroTextOnPage> <bodyText></bodyText> <showOnOverview>0</showOnOverview> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle>Talk to Us</calloutTitle> <calloutText>Call us on this number and someone will get back to you!</calloutText> <productIconOverview>1087</productIconOverview> <productIconTopNav>1086</productIconTopNav> <productIconNav>1092</productIconNav> <productSpecSheet /> <browserTitle>Account Opening</browserTitle> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground /> <backgroundColor /> <Textpage id="1173" parentID="1082" level="4" writerID="0" creatorID="0" nodeType="1056" template="1047" sortOrder="1" createDate="2011-06-28T23:07:57" updateDate="2011-06-28T23:58:42" nodeName="Deposits" urlName="deposits" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1069,1082,1173" isDoc=""> <pageTitle>Deposits</pageTitle> <introText></introText> <showIntroTextOnPage>0</showIntroTextOnPage> <bodyText></bodyText> <showOnOverview>0</showOnOverview> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview /> <productIconTopNav /> <productIconNav /> <productSpecSheet>1103</productSpecSheet> <browserTitle>Deposits</browserTitle> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground /> <backgroundColor /> </Textpage> <Textpage id="1180" parentID="1082" level="4" writerID="0" creatorID="0" nodeType="1056" template="1047" sortOrder="2" createDate="2011-06-28T23:26:54" updateDate="2011-06-28T23:58:42" nodeName="Loans" urlName="loans" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1069,1082,1180" isDoc=""> <pageTitle>Loans</pageTitle> <introText></introText> <showIntroTextOnPage>0</showIntroTextOnPage> <bodyText></bodyText> <showOnOverview>0</showOnOverview> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview /> <productIconTopNav /> <productIconNav /> <productSpecSheet>1103</productSpecSheet> <browserTitle /> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground /> <backgroundColor /> </Textpage> </Textpage> <Textpage id="1083" parentID="1069" level="3" writerID="0" creatorID="0" nodeType="1056" template="1047" sortOrder="2" createDate="2011-06-28T16:14:18" updateDate="2011-06-28T23:58:43" nodeName="Optimized Marketing" urlName="optimized-marketing" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1069,1083" isDoc=""> <pageTitle>Optimized Marketing</pageTitle> <introText> <p>This is optimized marketing</p> </introText> <showIntroTextOnPage>1</showIntroTextOnPage> <bodyText></bodyText> <showOnOverview>0</showOnOverview> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview>1088</productIconOverview> <productIconTopNav>1096</productIconTopNav> <productIconNav>1093</productIconNav> <productSpecSheet /> <browserTitle>Optimized Marketing</browserTitle> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground /> <backgroundColor /> <Textpage id="1181" parentID="1083" level="4" writerID="0" creatorID="0" nodeType="1056" template="1047" sortOrder="1" createDate="2011-06-28T23:27:35" updateDate="2011-06-28T23:58:43" nodeName="Lead Generation" urlName="lead-generation" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1069,1083,1181" isDoc=""> <pageTitle>Lead Generation</pageTitle> <introText></introText> <showIntroTextOnPage>0</showIntroTextOnPage> <bodyText></bodyText> <showOnOverview>0</showOnOverview> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview /> <productIconTopNav /> <productIconNav /> <productSpecSheet>1103</productSpecSheet> <browserTitle /> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground /> <backgroundColor /> </Textpage> <Textpage id="1182" parentID="1083" level="4" writerID="0" creatorID="0" nodeType="1056" template="1047" sortOrder="2" createDate="2011-06-28T23:27:49" updateDate="2011-06-28T23:58:43" nodeName="Conversion Optimization" urlName="conversion-optimization" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1069,1083,1182" isDoc=""> <pageTitle>Conversion Optimization</pageTitle> <introText></introText> <showIntroTextOnPage>0</showIntroTextOnPage> <bodyText></bodyText> <showOnOverview>0</showOnOverview> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview /> <productIconTopNav /> <productIconNav /> <productSpecSheet>1103</productSpecSheet> <browserTitle /> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground /> <backgroundColor /> </Textpage> </Textpage> <Textpage id="1084" parentID="1069" level="3" writerID="0" creatorID="0" nodeType="1056" template="1047" sortOrder="3" createDate="2011-06-28T16:14:28" updateDate="2011-06-28T23:58:43" nodeName="Risk Management" urlName="risk-management" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1069,1084" isDoc=""> <pageTitle>Risk Management</pageTitle> <introText> <p>Risk management intro</p> </introText> <showIntroTextOnPage>1</showIntroTextOnPage> <bodyText></bodyText> <showOnOverview>0</showOnOverview> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview>1090</productIconOverview> <productIconTopNav>1091</productIconTopNav> <productIconNav>1094</productIconNav> <productSpecSheet /> <browserTitle>Risk Management</browserTitle> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground /> <backgroundColor /> <Textpage id="1183" parentID="1084" level="4" writerID="0" creatorID="0" nodeType="1056" template="1047" sortOrder="1" createDate="2011-06-28T23:28:19" updateDate="2011-06-28T23:58:43" nodeName="FortiFI Fraud Prevention" urlName="fortifi-fraud-prevention" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1069,1084,1183" isDoc=""> <pageTitle>FortiFI Fraud Prevention</pageTitle> <introText></introText> <showIntroTextOnPage>0</showIntroTextOnPage> <bodyText></bodyText> <showOnOverview>0</showOnOverview> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview /> <productIconTopNav /> <productIconNav /> <productSpecSheet>1103</productSpecSheet> <browserTitle /> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground /> <backgroundColor /> </Textpage> <Textpage id="1184" parentID="1084" level="4" writerID="0" creatorID="0" nodeType="1056" template="1047" sortOrder="2" createDate="2011-06-28T23:28:38" updateDate="2011-06-28T23:58:43" nodeName="ID Verification Waterfall" urlName="id-verification-waterfall" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1069,1084,1184" isDoc=""> <pageTitle>ID Verification Waterfall</pageTitle> <introText></introText> <showIntroTextOnPage>0</showIntroTextOnPage> <bodyText></bodyText> <showOnOverview>0</showOnOverview> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview /> <productIconTopNav /> <productIconNav /> <productSpecSheet>1103</productSpecSheet> <browserTitle /> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground /> <backgroundColor /> </Textpage> </Textpage> <Textpage id="1085" parentID="1069" level="3" writerID="0" creatorID="0" nodeType="1056" template="1047" sortOrder="4" createDate="2011-06-28T16:14:46" updateDate="2011-06-28T23:58:44" nodeName="Developer Platform" urlName="developer-platform" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1069,1085" isDoc=""> <Textpage id="1185" parentID="1085" level="4" writerID="0" creatorID="0" nodeType="1056" template="1047" sortOrder="1" createDate="2011-06-28T23:30:37" updateDate="2011-06-28T23:58:44" nodeName="SDK" urlName="sdk" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1069,1085,1185" isDoc=""> <pageTitle>SDK</pageTitle> <introText></introText> <showIntroTextOnPage>0</showIntroTextOnPage> <bodyText></bodyText> <showOnOverview>0</showOnOverview> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview /> <productIconTopNav /> <productIconNav /> <productSpecSheet>1103</productSpecSheet> <browserTitle /> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground /> <backgroundColor /> </Textpage> <pageTitle>Developer Platform</pageTitle> <introText> <p>Dev platform intro text</p> </introText> <showIntroTextOnPage>1</showIntroTextOnPage> <bodyText></bodyText> <showOnOverview>0</showOnOverview> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview>1089</productIconOverview> <productIconTopNav>1097</productIconTopNav> <productIconNav>1095</productIconNav> <productSpecSheet /> <browserTitle>Developer Platform</browserTitle> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground /> <backgroundColor /> </Textpage> </Overview> <Overview id="1070" parentID="1053" level="2" writerID="0" creatorID="0" nodeType="1063" template="1052" sortOrder="2" createDate="2011-06-28T15:04:52" updateDate="2011-06-29T00:02:08" nodeName="Community" urlName="community" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1070" isDoc=""> <pageTitle>Community</pageTitle> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview /> <bodyText></bodyText> <productIconTopNav /> <productIconNav /> <productSpecSheet /> <browserTitle /> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground>1176</sectionBackground> <backgroundColor>adc587</backgroundColor> </Overview> <Overview id="1071" parentID="1053" level="2" writerID="0" creatorID="0" nodeType="1063" template="1052" sortOrder="3" createDate="2011-06-28T15:05:07" updateDate="2011-06-29T00:02:36" nodeName="Resources" urlName="resources" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1071" isDoc=""> <pageTitle>Resources</pageTitle> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview /> <bodyText></bodyText> <productIconTopNav /> <productIconNav /> <productSpecSheet /> <browserTitle /> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground>1178</sectionBackground> <backgroundColor>b8d2e3</backgroundColor> </Overview> <Overview id="1072" parentID="1053" level="2" writerID="0" creatorID="0" nodeType="1063" template="1052" sortOrder="4" createDate="2011-06-28T15:05:15" updateDate="2011-06-29T00:02:44" nodeName="About" urlName="about" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1072" isDoc=""> <Textpage id="1186" parentID="1072" level="3" writerID="0" creatorID="0" nodeType="1056" template="1047" sortOrder="1" createDate="2011-06-28T23:31:22" updateDate="2011-06-28T23:58:44" nodeName="Contact" urlName="contact" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1072,1186" isDoc=""> <pageTitle>Contact</pageTitle> <introText></introText> <showIntroTextOnPage>0</showIntroTextOnPage> <bodyText></bodyText> <showOnOverview>0</showOnOverview> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview /> <productIconTopNav /> <productIconNav /> <productSpecSheet /> <browserTitle /> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground /> <backgroundColor /> </Textpage> <pageTitle>About</pageTitle> <umbracoNaviHide>0</umbracoNaviHide> <umbracoRedirect /> <umbracoUrlAlias /> <calloutTitle /> <calloutText></calloutText> <productIconOverview /> <bodyText></bodyText> <productIconTopNav /> <productIconNav /> <productSpecSheet /> <browserTitle /> <metaKeywords /> <metaDescription></metaDescription> <sectionBackground>1174</sectionBackground> <backgroundColor>edac00</backgroundColor> </Overview> <NewsArea id="1073" parentID="1053" level="2" writerID="0" creatorID="0" nodeType="1067" template="0" sortOrder="5" createDate="2011-06-28T15:10:25" updateDate="2011-06-28T23:58:44" nodeName="News Area" urlName="news-area" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1073" isDoc=""> <NewsArticle id="1122" parentID="1073" level="3" writerID="0" creatorID="0" nodeType="1068" template="0" sortOrder="1" createDate="2011-06-28T20:13:06" updateDate="2011-06-28T23:58:44" nodeName="Andera Launches FortiFI for Real-Time Fraud Detection" urlName="andera-launches-fortifi-for-real-time-fraud-detection" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1073,1122" isDoc=""> <newsDate>2011-06-08T00:00:00</newsDate> <newsTitle>Andera Launches FortiFI for Real-Time Fraud Detection</newsTitle> <newsSummary></newsSummary> <internalPageLink /> <newsArticleFile>1153</newsArticleFile> <externalLink /> </NewsArticle> <NewsArticle id="1168" parentID="1073" level="3" writerID="0" creatorID="0" nodeType="1068" template="0" sortOrder="2" createDate="2011-06-28T22:21:11" updateDate="2011-06-28T23:58:44" nodeName="Andera Achieves the 500th Customer Milestone" urlName="andera-achieves-the-500th-customer-milestone" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1073,1168" isDoc=""> <newsDate>2011-03-19T00:00:00</newsDate> <newsTitle>Andera Achieves the 500th Customer Milestone</newsTitle> <newsSummary></newsSummary> <internalPageLink /> <newsArticleFile>1140</newsArticleFile> <externalLink /> </NewsArticle> <NewsArticle id="1169" parentID="1073" level="3" writerID="0" creatorID="0" nodeType="1068" template="0" sortOrder="3" createDate="2011-06-28T22:22:07" updateDate="2011-06-28T23:58:45" nodeName="Andera releases Software Development Kit Solution will save thousands of hours for developers" urlName="andera-releases-software-development-kit-solution-will-save-thousands-of-hours-for-developers" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1073,1169" isDoc=""> <newsDate>2011-01-21T00:00:00</newsDate> <newsTitle>Andera releases Software Development Kit Solution will save thousands of hours for developers</newsTitle> <newsSummary></newsSummary> <internalPageLink /> <newsArticleFile>1163</newsArticleFile> <externalLink /> </NewsArticle> <NewsArticle id="1170" parentID="1073" level="3" writerID="0" creatorID="0" nodeType="1068" template="0" sortOrder="4" createDate="2011-06-28T22:22:56" updateDate="2011-06-28T23:58:45" nodeName="ANDERA TO Grow Headcount By 40% - 24 Positions Open in Providence Headquarters" urlName="andera-to-grow-headcount-by-40-24-positions-open-in-providence-headquarters" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1073,1170" isDoc=""> <newsDate>2010-12-01T00:00:00</newsDate> <newsTitle>ANDERA TO Grow Headcount By 40% - 24 Positions Open in Providence Headquarters</newsTitle> <newsSummary></newsSummary> <internalPageLink /> <newsArticleFile>1159</newsArticleFile> <externalLink /> </NewsArticle> </NewsArea> <Clients id="1074" parentID="1053" level="2" writerID="0" creatorID="0" nodeType="1064" template="0" sortOrder="6" createDate="2011-06-28T15:10:35" updateDate="2011-06-28T23:58:45" nodeName="Clients" urlName="clients" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1074" isDoc="" /> <UtilityLinks id="1075" parentID="1053" level="2" writerID="0" creatorID="0" nodeType="1057" template="0" sortOrder="7" createDate="2011-06-28T15:12:31" updateDate="2011-06-28T23:58:45" nodeName="Utility Links" urlName="utility-links" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1075" isDoc=""> <UtilityLink id="1118" parentID="1075" level="3" writerID="0" creatorID="0" nodeType="1058" template="0" sortOrder="0" createDate="2011-06-28T19:52:26" updateDate="2011-06-28T23:58:45" nodeName="Contact" urlName="contact" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1075,1118" isDoc=""> <utilityPageLink>1186</utilityPageLink> <utilityExternalLink /> <utilityMediaLink /> <umbracoNaviHide>0</umbracoNaviHide> </UtilityLink> <UtilityLink id="1117" parentID="1075" level="3" writerID="0" creatorID="0" nodeType="1058" template="0" sortOrder="1" createDate="2011-06-28T19:52:01" updateDate="2011-06-28T23:58:45" nodeName="Careers" urlName="careers" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1075,1117" isDoc=""> <utilityPageLink /> <utilityExternalLink>http://www.google.com/</utilityExternalLink>; <utilityMediaLink /> <umbracoNaviHide>0</umbracoNaviHide> </UtilityLink> <UtilityLink id="1119" parentID="1075" level="3" writerID="0" creatorID="0" nodeType="1058" template="0" sortOrder="2" createDate="2011-06-28T19:53:35" updateDate="2011-06-28T23:58:45" nodeName="Site Map" urlName="site-map" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1075,1119" isDoc=""> <utilityPageLink /> <utilityExternalLink /> <utilityMediaLink>1086</utilityMediaLink> <umbracoNaviHide>0</umbracoNaviHide> </UtilityLink> </UtilityLinks> <HomepageFeatures id="1076" parentID="1053" level="2" writerID="0" creatorID="0" nodeType="1060" template="0" sortOrder="8" createDate="2011-06-28T15:13:46" updateDate="2011-06-28T23:58:45" nodeName="Homepage Features" urlName="homepage-features" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1076" isDoc=""> <HomepageFeature id="1077" parentID="1076" level="3" writerID="0" creatorID="0" nodeType="1061" template="0" sortOrder="1" createDate="2011-06-28T15:13:53" updateDate="2011-06-28T23:58:45" nodeName="Feature 1" urlName="feature-1" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1076,1077" isDoc=""> <featureTitle>You</featureTitle> <featureImage>1112</featureImage> <featureLink /> </HomepageFeature> <HomepageFeature id="1123" parentID="1076" level="3" writerID="0" creatorID="0" nodeType="1061" template="0" sortOrder="2" createDate="2011-06-28T20:50:36" updateDate="2011-06-28T23:58:45" nodeName="Feature 2" urlName="feature-2" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1076,1123" isDoc=""> <featureTitle>Feature 2</featureTitle> <featureImage>1113</featureImage> <featureLink /> </HomepageFeature> <HomepageFeature id="1124" parentID="1076" level="3" writerID="0" creatorID="0" nodeType="1061" template="0" sortOrder="3" createDate="2011-06-28T20:50:57" updateDate="2011-06-28T23:58:45" nodeName="Feature 3" urlName="feature-3" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1076,1124" isDoc=""> <featureTitle>Feature 3</featureTitle> <featureImage>1114</featureImage> <featureLink /> </HomepageFeature> <HomepageFeature id="1125" parentID="1076" level="3" writerID="0" creatorID="0" nodeType="1061" template="0" sortOrder="4" createDate="2011-06-28T20:51:15" updateDate="2011-06-28T23:58:45" nodeName="Feature 4" urlName="feature-4" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1076,1125" isDoc=""> <featureTitle>Feature 4</featureTitle> <featureImage>1115</featureImage> <featureLink /> </HomepageFeature> <HomepageFeature id="1126" parentID="1076" level="3" writerID="0" creatorID="0" nodeType="1061" template="0" sortOrder="5" createDate="2011-06-28T20:51:35" updateDate="2011-06-28T23:58:45" nodeName="Feature 5" urlName="feature-5" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1076,1126" isDoc=""> <featureTitle>What can Andera do for you?</featureTitle> <featureImage>1116</featureImage> <featureLink>1053</featureLink> </HomepageFeature> </HomepageFeatures> <HomepageTabs id="1187" parentID="1053" level="2" writerID="0" creatorID="0" nodeType="1110" template="0" sortOrder="9" createDate="2011-06-29T00:13:23" updateDate="2011-06-29T00:14:15" nodeName="Homepage Tabs" urlName="homepage-tabs" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1187" isDoc=""> <HomepageTab id="1188" parentID="1187" level="3" writerID="0" creatorID="0" nodeType="1111" template="0" sortOrder="1" createDate="2011-06-29T00:13:34" updateDate="2011-06-29T00:14:18" nodeName="Account Opening" urlName="account-opening" writerName="Nik Wahlberg" creatorName="Nik Wahlberg" path="-1,1053,1187,1188" isDoc=""> <tabIcon>1086</tabIcon> <tabSummary>This is the tab summary about this account. Cool. </tabSummary> <tabLInk>1082</tabLInk> </HomepageTab> </HomepageTabs> </Homepage>Doing a copy-of on $currentPage/* [name()='UtilityLink'] produces nothing. What did I miss?
Thanks Doug!
Ah Kim, you got it! Of course the // works as opposed to single /. I've been away too long :(
Thanks a bunch!
-- Nik
Ps. Does that make the built-in template for List Subpages by Document Type wrong then?
The answer is simple... your xpath works against your xml and your xml has the following (very simplified):
So, when you're on the Homepage of your site, that's what $currentPage will be, the Homepage.
From there you want to go down the content tree, through the UtilityLinks node to all the UtilityLink nodes. That is, $currentPage/UtilityLinks/*
If you want to simply look for all the UtilityLink nodes you could do any of the following which are all basically equivalent:
Of course, descendent-or-self (the short-hand is '//') is slower than specifying the full path but unless you've got a boat load of nodes you're unlikely to notice it. Still, keep it in mind; you want to specify as much as you can to get maximum performance.
cheers,
doug.
Aaaaaand... Kim types faster than I do! :)
Nice work Kim!
cheers,
doug.
Thanks Doug, it makes total sense now. Unless we have a HUGE site, I typically want to be as "unspecific" as possible in case the structure of the content changes. In this case though, it's a matter of being rusty :)
Thanks to both of you!
-- Nik
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.