我知道这应该很简单,但我对XSLT毫无用处(我正在学习......)。
我正在建立我的第一个Umbraco网站,并为顶级菜单启用动态导航,但我在页脚菜单上失败(没有显示)。
网站结构为:
Site (Master template - level 1)
- Home (content page)
- Candidates (content page)
- Contact (content page)
- Clients (content page)
- Footer Pages (Container folder hidden from Nav - level 2)
- Links
- Terms and Conditions
- Cookies
- Privacy Policy
我原本以为我可以使用与顶层菜单相同的XSLT(如下所示),但是使用2级而不是1级但这不起作用(没有任何东西被拉出):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<ul id="topNavigation">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="@id = $currentPage/@id">
<xsl:attribute name="class">active</xsl:attribute>
</xsl:if>
<a class="navigation" href="{umbraco.library:NiceUrl(@id)}">
<span><xsl:value-of select="@nodeName"/></span>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
所以我只是想列出(链接|条款和条件| Cookies |隐私政策)的页脚页...
任何指导都会很棒。谢谢!
这是网站XML:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE root[
<!ELEMENT umbBlog ANY>
<!ATTLIST umbBlog id ID #REQUIRED>
<!ELEMENT umbBlogPost ANY>
<!ATTLIST umbBlogPost id ID #REQUIRED>
<!ELEMENT ContentFolder ANY>
<!ATTLIST ContentFolder id ID #REQUIRED>
<!ELEMENT DateFolder ANY>
<!ATTLIST DateFolder id ID #REQUIRED>
<!ELEMENT umbHomepage ANY>
<!ATTLIST umbHomepage id ID #REQUIRED>
<!ELEMENT umbNewsArea ANY>
<!ATTLIST umbNewsArea id ID #REQUIRED>
<!ELEMENT umbNewsArticle ANY>
<!ATTLIST umbNewsArticle id ID #REQUIRED>
<!ELEMENT Team24HomePage ANY>
<!ATTLIST Team24HomePage id ID #REQUIRED>
<!ELEMENT Team24InnerPage ANY>
<!ATTLIST Team24InnerPage id ID #REQUIRED>
<!ELEMENT Team24MasterPage ANY>
<!ATTLIST Team24MasterPage id ID #REQUIRED>
<!ELEMENT umbTextpage ANY>
<!ATTLIST umbTextpage id ID #REQUIRED>
<!ELEMENT umediaSlider ANY>
<!ATTLIST umediaSlider id ID #REQUIRED>
<!ELEMENT umediaSliders ANY>
<!ATTLIST umediaSliders id ID #REQUIRED>
]>
<root id="-1">
<Team24MasterPage id="1120" parentID="-1" level="1" creatorID="0" sortOrder="3" createDate="2013-06-26T11:06:54" updateDate="2013-06-26T11:21:36" nodeName="Team 24 Site" urlName="team-24-site" path="-1,1120" isDoc="" nodeType="1119" creatorName="admin" writerName="admin" writerID="0" template="0">
<Team24HomePage id="1096" parentID="1120" level="2" creatorID="0" sortOrder="0" createDate="2013-06-20T00:33:15" updateDate="2013-06-26T11:28:37" nodeName="Home" urlName="home" path="-1,1120,1096" isDoc="" nodeType="1092" creatorName="admin" writerName="admin" writerID="0" template="1093">
<homepagePageTitle>Team 24 Home Page</homepagePageTitle>
<homepageMetaDescription>Description of the page goes here</homepageMetaDescription>
<homepageMetaKeywords>keywords,go,here</homepageMetaKeywords>
<homepageHeading1>Homepage Header Goes Here</homepageHeading1>
<homepageFeatureImage>1100</homepageFeatureImage>
<homepageFeatureImageAltTag>Add your alt tag for the featured image here.</homepageFeatureImageAltTag>
<homepageFeatureImageHeading>Feature Image Header Goes Here</homepageFeatureImageHeading>
<homepageFeatureImageSubheading>Feature image sub heading</homepageFeatureImageSubheading>
<homepageFeatureImageSubheadingLink>www.linkedin.com/profile/view?id=8209529&locale=en_US&trk=tyah</homepageFeatureImageSubheadingLink>
<homepageFeatureBox1Heading>Homepage H2 Heading</homepageFeatureBox1Heading>
<homepageFeatureBox1Content><![CDATA[Paragraph text at vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Paragraph text at vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti.]]></homepageFeatureBox1Content>
<homepageFeatureBox2Heading>H3 Inside Team24 Because we care</homepageFeatureBox2Heading>
<homepageFeatureBox2Content><![CDATA[Our staff work around the clock to deliver quality and care. Supporting our candidates, clients, patients and their families is all about team work. At Team24 we are experienced, passionate and committed to what we do. Come and join us through this journey of Team24 and see what we do. Our staff work around the clock to deliver quality and care. ]]></homepageFeatureBox2Content>
<homepageFeatureBox2Image>1110</homepageFeatureBox2Image>
<homepageFeatureBox2ImageAltTag>Feature Box 2 Image Alt Tag</homepageFeatureBox2ImageAltTag>
<homepageFeatureBox2LinkText>Find out more</homepageFeatureBox2LinkText>
<homepageFeatureBox2Link>www.linkedin.com/profile/view?id=8209529&locale=en_US&trk=tyah</homepageFeatureBox2Link>
<homepageSideBox1Heading>H3 SIDE TITLE 1</homepageSideBox1Heading>
<homepageSideBox1Text><![CDATA[Side box 1 text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.]]></homepageSideBox1Text>
<homepageSideBox1LinkText>Find out more</homepageSideBox1LinkText>
<homepageSideBox1Link>www.linkedin.com/profile/view?id=8209529&locale=en_US&trk=tyah</homepageSideBox1Link>
<homepageSideBox2Heading>H3 SIDE TITLE 2</homepageSideBox2Heading>
<hompageSideBox2Text><![CDATA[Side box 2 text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor.]]></hompageSideBox2Text>
<homepageSideBox2LinkText>We love Mike Perrett</homepageSideBox2LinkText>
<homepageSideBox2Link>www.linkedin.com/profile/view?id=8209529&locale=en_US&trk=tyah</homepageSideBox2Link>
<homepageSideBox3Heading>H3 Side Title 3</homepageSideBox3Heading>
<homepageSideBox3Text><![CDATA[Side box 3 text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor.]]></homepageSideBox3Text>
<homepageSideBox3LinkText>Sed do eiusmod</homepageSideBox3LinkText>
<homepageSideBox3Link>www.linkedin.com/profile/view?id=8209529&locale=en_US&trk=tyah</homepageSideBox3Link>
<homepageSideBox4Heading>H3 Side Title 4</homepageSideBox4Heading>
<homepageSideBox4Text><![CDATA[Side box 4 text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor.]]></homepageSideBox4Text>
<homepageSideBox4LinkText>Contact Us</homepageSideBox4LinkText>
<homepageSideBox4Link>/contact.aspx</homepageSideBox4Link>
<homepageJobList><![CDATA[<ul>
<li><a href="#">Scolling job item 1</a></li>
<li><a href="#">Scolling job item 2</a></li>
<li><a href="#">Scolling job item 3</a></li>
<li><a href="#">Scolling job item 4</a></li>
<li><a href="#">Scolling job item 5</a></li>
<li><a href="#">Scolling job item 6</a></li>
<li><a href="#">Scolling job item 7</a></li>
<li><a href="#">Scolling job item 8</a></li>
<li><a href="#">Scolling job item 9</a></li>
<li><a href="#">Scolling job item 10</a></li>
</ul>]]></homepageJobList>
</Team24HomePage>
<Team24InnerPage id="1103" parentID="1120" level="2" creatorID="0" sortOrder="1" createDate="2013-06-21T01:46:07" updateDate="2013-06-26T12:25:51" nodeName="Candidates" urlName="candidates" path="-1,1120,1103" isDoc="" nodeType="1094" creatorName="admin" writerName="admin" writerID="0" template="1095">
<pageTitle>Candidates</pageTitle>
<metaDescription>Meta Description Goes Here</metaDescription>
<metaKeywords>keywords,go,here</metaKeywords>
<innerPageHeading1>Candidates</innerPageHeading1>
<innerPageHeading2 />
</Team24InnerPage>
<Team24InnerPage id="1105" parentID="1120" level="2" creatorID="0" sortOrder="2" createDate="2013-06-21T01:47:44" updateDate="2013-06-26T11:25:04" nodeName="Contact" urlName="contact" path="-1,1120,1105" isDoc="" nodeType="1094" creatorName="admin" writerName="admin" writerID="0" template="1095">
<pageTitle>Contact</pageTitle>
<metaDescription>Meta Description Goes Here</metaDescription>
<metaKeywords>keywords,go,here</metaKeywords>
<innerPageHeading1>Contact</innerPageHeading1>
<innerPageHeading2 />
</Team24InnerPage>
<Team24InnerPage id="1102" parentID="1120" level="2" creatorID="0" sortOrder="3" createDate="2013-06-21T00:58:03" updateDate="2013-06-26T11:25:04" nodeName="Clients" urlName="clients" path="-1,1120,1102" isDoc="" nodeType="1094" creatorName="admin" writerName="admin" writerID="0" template="1095">
<pageTitle>Clients</pageTitle>
<metaDescription>Meta Description Goes Here</metaDescription>
<metaKeywords>keywords,go,here</metaKeywords>
<innerPageHeading1>Clients</innerPageHeading1>
<innerPageHeading2 />
</Team24InnerPage>
<ContentFolder id="1112" parentID="1120" level="2" creatorID="0" sortOrder="4" createDate="2013-06-26T09:53:08" updateDate="2013-06-26T11:25:04" nodeName="Footer Pages" urlName="footer-pages" path="-1,1120,1112" isDoc="" nodeType="1111" creatorName="admin" writerName="admin" writerID="0" template="0">
<Team24InnerPage id="1116" parentID="1112" level="3" creatorID="0" sortOrder="12" createDate="2013-06-26T09:54:25" updateDate="2013-06-26T11:21:37" nodeName="Links" urlName="links" path="-1,1120,1112,1116" isDoc="" nodeType="1094" creatorName="admin" writerName="admin" writerID="0" template="1095">
<pageTitle>Links</pageTitle>
<metaDescription>Meta Description Goes Here</metaDescription>
<metaKeywords>keywords,go,here</metaKeywords>
<innerPageHeading1>Links</innerPageHeading1>
<innerPageHeading2 />
</Team24InnerPage>
<Team24InnerPage id="1115" parentID="1112" level="3" creatorID="0" sortOrder="13" createDate="2013-06-26T09:54:11" updateDate="2013-06-26T11:21:37" nodeName="Terms &amp; Conditions" urlName="terms-amp-conditions" path="-1,1120,1112,1115" isDoc="" nodeType="1094" creatorName="admin" writerName="admin" writerID="0" template="1095">
<pageTitle>Terms and Conditions</pageTitle>
<metaDescription>Meta Description Goes Here</metaDescription>
<metaKeywords>keywords,go,here</metaKeywords>
<innerPageHeading1>Terms and Conditions</innerPageHeading1>
<innerPageHeading2 />
</Team24InnerPage>
<Team24InnerPage id="1114" parentID="1112" level="3" creatorID="0" sortOrder="14" createDate="2013-06-26T09:53:54" updateDate="2013-06-26T11:21:37" nodeName="Cookies" urlName="cookies" path="-1,1120,1112,1114" isDoc="" nodeType="1094" creatorName="admin" writerName="admin" writerID="0" template="1095">
<pageTitle>Cookies</pageTitle>
<metaDescription>Meta Description Goes Here</metaDescription>
<metaKeywords>keywords,go,here</metaKeywords>
<innerPageHeading1>Cookies</innerPageHeading1>
<innerPageHeading2 />
</Team24InnerPage>
<Team24InnerPage id="1113" parentID="1112" level="3" creatorID="0" sortOrder="15" createDate="2013-06-26T09:53:44" updateDate="2013-06-26T11:21:37" nodeName="Privacy Policy" urlName="privacy-policy" path="-1,1120,1112,1113" isDoc="" nodeType="1094" creatorName="admin" writerName="admin" writerID="0" template="1095">
<pageTitle>Privacy Policy</pageTitle>
<metaDescription>Meta Description Goes Here</metaDescription>
<metaKeywords>keywords,go,here</metaKeywords>
<innerPageHeading1>Privacy Policy</innerPageHeading1>
<innerPageHeading2 />
</Team24InnerPage>
<umbracoRedirect />
<umbracoNaviHide>1</umbracoNaviHide>
</ContentFolder>
<footerLinkedinLink>http://www.linkedin.com/profile/view?id=8209529&locale=en_US&trk=tyah</footerLinkedinLink>
<headerTelephoneNumber>0845 370 2424</headerTelephoneNumber>
</Team24MasterPage>
</root>
答案 0 :(得分:1)
我注意到您的所有节点都具有相同的文档类型。
基本上,最好为不同类型的项目(在您的情况下为页脚项目)提供不同的文档类型。在这种情况下,您可以使用其文档类型在xslt中过滤它们。