Copied to clipboard

Flag this post as spam?

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


  • Johan Roug 97 posts 153 karma points
    Sep 03, 2009 @ 21:57
    Johan Roug
    0

    using xslt to display campaigns

    I have the following tree

    • content
    • Kampagner
    • campaign01
    • campaign02

    each campaign in this folder have 3 fields (alias names: campaignHeader, campaignText, campaignImage)

    on a normal page which is on the same level as "Kampagner", I use the ultimate picker to display all campaigns.The alias name is "campaignss" THe editor can then choose via checkboxes what campaigns should be shown on the page. Or this is the way I want it to function

    can anyone help me out? I have tried a lot, and I can make the ID show, sometimes the content.. but I am getting blind on the code

    I use something like

    <xsl:variable name="pageCamp" select="$currentPage/data [@alias = 'campaigns']"/>

    <xsl:for-each select="$pageCamp">

               <xsl:if test="$currentPage/data [@alias = 'campaigns'] ">

                          <h2>

                               <xsl:value-of select="$pageCamp"/>

                          </h2>

                          <p>

                                     <xsl:value-of select="$currentPage/ancestor-or-self::node [@level = '1']/following::node/data [@alias = 'campaignHeader']"/>

                          </p>

               </xsl:if>

    </xsl:for-each>

  • Johan Roug 97 posts 153 karma points
    Sep 03, 2009 @ 22:16
    Johan Roug
    0

    <!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-520092929 1073786111 9 0 415 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:10.0pt; line-height:115%;} @page Section1 {size:612.0pt 792.0pt; margin:3.0cm 2.0cm 3.0cm 2.0cm; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:1004820704; mso-list-type:hybrid; mso-list-template-ids:-1395331246 67502081 67502083 67502085 67502081 67502083 67502085 67502081 67502083 67502085;} @list l0:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-18.0pt; font-family:Symbol;} @list l0:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-18.0pt; font-family:"Courier New";} @list l0:level3 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-18.0pt; font-family:Wingdings;} ol {margin-bottom:0cm;} ul {margin-bottom:0cm;} -->

    I have the following structure

    • Content
      • Home
        • Page
    • Kampagner
      • Campaign01
      • Campaign02

     

    On the campaign documents I have 3 fields (alias names: campaignHeader, campaignText, campaignImage). On page like home and page, I have the option to choose which campaign I want on either page. I can choose them with checkboxes.

    So if I have 4 campaigns but only 2 is selected on a page, there should only be rendrede 2 on that page.

    I have tried to make some XSLT which does this, but it doesn’t quite do the job. Can someone help?

     

    <xsl:variable name="pageCamp" select="$currentPage/data [@alias = 'campaigns']"/>

     

    <xsl:for-each select="$pageCamp">

               <xsl:if test="$currentPage/data [@alias = 'campaigns'] ">

                          <h2>

                                     <xsl:value-of select="$pageCamp"/>

                          </h2>

                          <p>

                                     <xsl:value-of select="$currentPage/ancestor-or-self::node [@level = '1']/following::node/data [@alias = 'campaignHeader']"/>

                          </p>

               </xsl:if>

    </xsl:for-each>

  • dandrayne 1138 posts 2262 karma points
    Sep 04, 2009 @ 12:09
    dandrayne
    0

    HI there

    I attempted to answer this here -> http://our.umbraco.org/forum/developers/xslt/3924-using-xslt-to-display-campaigns

    Good luck!

Please Sign in or register to post replies

Write your reply to:

Draft