开发者

Umbraco, XSLT, How do I render child content in a parent page?

开发者 https://www.devze.com 2023-01-10 04:34 出处:网络
I have content that I\'ve structured as follows in the content section in umbraco: Items under the content node that have a folder icon are Content Pages.

I have content that I've structured as follows in the content section in umbraco:

Items under the content node that have a folder icon are Content Pages. A content page can have another content page as a child or a content section which are the items with doc with image icon.

Umbraco, XSLT, How do I render child content in a parent page?

(source: flickr.com)

I have a settings section that I've structured as follows:

开发者_如何学编程

Each SectionDocumentType has a limited number of available templates the user can select

Umbraco, XSLT, How do I render child content in a parent page?

(source: flickr.com)

What I'd like to do is to render Sections as rows of data in a content page while ignoring child content pages.

I'd like each section "row" to display template and all.

I'm new to XSLT so I'm wondering how could I do this?

Thanks for your help!


I figured this out.

Here is the xslt:

<?xml version="1.0" encoding="UTF-8"?>
   <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
       <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"
     xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon"
     xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"
     xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath"
     xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"
     xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
     xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets">
   <xsl:output method="html" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
  <xsl:for-each select="$currentPage/child::*[@isDoc][@nodeType != 1230]">
      <xsl:value-of select="umbraco.library:RenderTemplate(@id,@template)" disable-output-escaping="yes"/>
  </xsl:for-each>
</xsl:template>

</xsl:stylesheet>

Also I had to add this line to my content section <umbraco:DisableRequestValidation runat="server"/> in my content section templates.

Here is how you use it in your page template.

<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
**<umbraco:DisableRequestValidation runat="server"/>** 
**YOUR HTML GOES HERE**
</asp:Content>​
0

精彩评论

暂无评论...
验证码 换一张
取 消