Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Peter 3 posts 23 karma points
    Oct 08, 2010 @ 19:55
    Peter
    0

    Document types as child documents (classic asp includes)

    First post / question.

    Can child pages, or the content from them, specifically the generic properties one defines and then populates upon instantiation, be incorporated into a parent page dynamically, a la

    The goal here is to create a container page and have 'n' number of child sections of a different document type used to build out the body section.  As an example if I were building a resume template I'd want to use the contents of the child pages to build out the repeating sections for my job experience so in the content tree view it would look something like this:

     - Resume page doc type (top level) with static content

     -- job 1 (dynamic / injected )

    -- job 2 (dynamic / injected )

    -- job 3 (dynamic / injected )

    more static content from Resume page doc type (footer etc...)

    So that at runtime I can/want to use a XSLT macro to inject the information from each child page (job 1,2.3...) into the containing Resume page.

     

    Any comments on this design?

     

    Thanks

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Oct 09, 2010 @ 08:42
    Morten Bock
    1

    That is indeed possible.

    Just create an xslt macro, and use the $currentPage parameter to get to the subpages using xpath. Something like:

    <!-- Loop the child pages -->
    <xsl:for-each select="$currentPage/*[@isDoc]>
    <!-- Write out the genereic property "MyProperty"-->
    <h1><xsl:value-of select="MyProperty"/></h1>
    <!-- To see the exact xml for the node, use this: -->
    <!--<xsl:copy-of select="."/>-->
    </xsl:for-each>

    Hope this gets you started. There is also a lot to learn from the built in xslt templates that you can choose from when creating a new file.

  • Peter 3 posts 23 karma points
    Oct 09, 2010 @ 17:41
    Peter
    0

    Thank you for your reply.

    If I use a variation upon your example, shown below, I get all the information for the current context as it iterates the pages.

    <xsl:template match="/">


    <ul>
      <xsl:for-each select="$currentPage/*[@isDoc]">
      <h3>
        <xsl:value-of select="@nodeName"/>
        h3>
        <xsl:value-of select="."/>
    xsl:for-each>
    ul>

    xsl:template>

    If I use the  <xsl:value-of select="data [@alias='Any Generic Property']"/> expression I don't get any data.

    Looking at the cmscontentxml table in the DB I can see the format of the XML in the table so

    I should be able to grab that from the current context and in fact when I test the xPath using an xPath parser it works.

    Here is the XML format as stored in cmscontentxml table:

    <cEngagement id="1121" parentID="1110" level="2" writerID="0" creatorID="0" nodeType="1118" template="1119" sortOrder="2" createDate="2010-10-08T12:00:21" updateDate="2010-10-08T13:33:06" nodeName="SpeakEZ" urlName="speakez" writerName="Administrator" creatorName="Administrator" path="-1,1110,1121" isDoc="">
      <engagementTitle>SpeakEZ Systems (start up)</engagementTitle>
      <client>Start up</client>
      <dateStart>2009-04-01T00:00:00</dateStart>
      <dateEnd>2009-08-01T00:00:00</dateEnd>
      <technologies>
        <![CDATA[jQuery
    ASP.net 3.5
    Windows Mobile 6/6.5
    SQL Server 2005
    Microsoft Exchange Server 2007]]>
      </technologies>
      <engagementDescription><![CDATA[The goal of this effort was to enable users to update their Outlook calendar using natural voice commands via their wireless handset.]]></engagementDescription>
    </cEngagement>
    
        
      
      

    Any suggestions as to where I'm in error?

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Oct 09, 2010 @ 18:22
    Morten Bock
    0

    You should not use the data[...] approach. You are using the new schema so just do as in my example:

    <xsl:value-of select="technologies"/>

     

  • Peter 3 posts 23 karma points
    Oct 09, 2010 @ 21:05
    Peter
    0

    That did the trick.

    Many thanks!

Please Sign in or register to post replies

Write your reply to:

Draft