Copied to clipboard

Flag this post as spam?

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


  • Kevin Page 15 posts 35 karma points
    Oct 04, 2011 @ 15:40
    Kevin Page
    0

    Displaying two nodes per line

    Hi all,

    This is my first time posting so be gentle ;)

    I'm building a website for my local school and I've setup two doctypes, one called MyClassArea and the other called ClassDetailsArea.

    The idea being that each teacher will create a ClassDetailsArea doc which contains their name, photo and the year of the class that they run.

    The school have two classes per year so I want to create an XSLT script that will display a box for each year going down the page with the two photos of the teachers on the left and right of the box and their names underneith that can then be linked to the class details page.

    I'm pretty sure I can figure out most of this,  but I'm kinda stuck working out how to display the two pictures and names from the two nodes next two each other in each year group.

    If anyone's got any ideas they would be gratly appreciated.

    Many Thanks

     

    Here's my XML for the class doctypes :-

     

    MyClassArea id="1092" parentID="1089" level="2" writerID="1" creatorID="1" nodeType="1055" template="1077" sortOrder="2" createDate="2011-09-12T13:58:20" updateDate="2011-09-12T13:58:23" nodeName="My Class" urlName="my-class" writerName="kpage" creatorName="kpage" path="-1,1089,1092" isDoc=""

    >

    <

     

     

    ClassDetailsArea id="1177" parentID="1092" level="3" writerID="1" creatorID="1" nodeType="1047" template="1070" sortOrder="3" createDate="2011-09-27T23:30:06" updateDate="2011-09-27T23:30:28" nodeName="Miss Williams" urlName="miss-williams" writerName="kpage" creatorName="kpage" path="-1,1089,1092,1177" isDoc=""

    >

    <

     

     

    pagecontent><![CDATA[]]></pagecontent

    >

    <

     

     

    teachersName>Miss ABC</teachersName

    >

    <

     

     

    teacherPicture

    >

    </

     

     

    teacherPicture

    >

    <

     

     

    classYear><![CDATA[Reception]]></classYear

    >

    </

     

     

    ClassDetailsArea

    >

    <

     

     

    ClassDetailsArea id="1179" parentID="1092" level="3" writerID="1" creatorID="1" nodeType="1047" template="1070" sortOrder="3" createDate="2011-09-27T23:31:21" updateDate="2011-09-27T23:31:34" nodeName="Mrs Spearman" urlName="mrs-spearman" writerName="kpage" creatorName="kpage" path="-1,1089,1092,1179" isDoc=""

    >

    <

     

     

    pagecontent><![CDATA[]]></pagecontent

    >

    <

     

     

    teachersName>Mrs DEF</teachersName

    >

    <

     

     

    teacherPicture

    >

    </

     

     

    teacherPicture

    >

    <

     

     

    classYear><![CDATA[Year 2]]></classYear

    >

    </

     

     

    ClassDetailsArea

    >

    <

     

     

    ClassDetailsArea id="1180" parentID="1092" level="3" writerID="1" creatorID="1" nodeType="1047" template="1070" sortOrder="4" createDate="2011-09-27T23:31:45" updateDate="2011-09-27T23:31:57" nodeName="Mrs Hatton" urlName="mrs-hatton" writerName="kpage" creatorName="kpage" path="-1,1089,1092,1180" isDoc=""

    >

    <

     

     

    pagecontent><![CDATA[]]></pagecontent

    >

    <

     

     

    teachersName>Mrs GHI</teachersName

    >

    <

     

     

    teacherPicture

    >

    </

     

     

    teacherPicture

    >

    <

     

     

    classYear><![CDATA[Year 1]]></classYear

    >

    </

     

     

    ClassDetailsArea

    >

    <

     

     

    ClassDetailsArea id="1178" parentID="1092" level="3" writerID="1" creatorID="1" nodeType="1047" template="1070" sortOrder="4" createDate="2011-09-27T23:30:44" updateDate="2011-09-27T23:30:58" nodeName="Mrs Bowyer" urlName="mrs-bowyer" writerName="kpage" creatorName="kpage" path="-1,1089,1092,1178" isDoc=""

    >

    <

     

     

    pagecontent><![CDATA[]]></pagecontent

    >

    <

     

     

    teachersName>Mrs JKL</teachersName

    >

    <

     

     

    teacherPicture

    >

    </

     

     

    teacherPicture

    >

    <

     

     

    classYear><![CDATA[Reception]]></classYear

    >

    </

     

     

    ClassDetailsArea

    >

    <

     

     

    ClassDetailsArea id="1181" parentID="1092" level="3" writerID="1" creatorID="1" nodeType="1047" template="1070" sortOrder="5" createDate="2011-09-27T23:32:31" updateDate="2011-09-27T23:32:45" nodeName="Mrs Willbourne" urlName="mrs-willbourne" writerName="kpage" creatorName="kpage" path="-1,1089,1092,1181" isDoc=""

    >

    <

     

     

    pagecontent><![CDATA[]]></pagecontent

    >

    <

     

     

    teachersName>Mrs MNO</teachersName

    >

    <

     

     

    teacherPicture

    >

    </

     

     

    teacherPicture

    >

    <

     

     

    classYear><![CDATA[Year 2]]></classYear

    >

    </

     

     

    ClassDetailsArea

    >

    </

     

     

    MyClassArea

    >

  • Markus Johansson 1938 posts 5866 karma points MVP 2x c-trib
    Oct 05, 2011 @ 07:21
    Markus Johansson
    0

    How would you like the generated html to look? Would Razor be an option for you? I think is easier to use if you never have look at XSLT before.

  • Kevin Page 15 posts 35 karma points
    Oct 05, 2011 @ 08:20
    Kevin Page
    0

    To be honest I've not looked at Razor yet as I'm only just starting out so I've been scripting with XSLT everywhere.

    Not sure if it makes any differance at all, but I'm using version 4.7.

    I'll start reading up on Razor, but for the time being I'm not too fussed what the actualy HTML looks like as long as it works ;)

    Also, I'm using the 'Umbraco User's Guide' by Nik Wahlberg & Paul Sterling as my bible at the moment, but it only mentions Razor very briefly.  If you could suggest a good source of reading material for Razor, I'll give it a look.

    Thanks

  • Markus Johansson 1938 posts 5866 karma points MVP 2x c-trib
    Oct 05, 2011 @ 08:37
    Markus Johansson
    0

    Have you worked with XSLT before? If not i would strongly recommend you to look closer at Razor. This looks like a good blogpost:

    http://cultiv.nl/blog/2011/2/16/how-to-use-razor-in-umbraco/

    The official Umbraco blog at umbraco.com has a great 10 parts serie on the new Razor feture:

    http://umbraco.com/follow-us/blog-archive/2011/2/23/umbraco-47-razor-feature-walkthrough-%E2%80%93-part-1.aspx

     

  • Kevin Page 15 posts 35 karma points
    Oct 05, 2011 @ 08:48
    Kevin Page
    0

    I've not used XSLT before, but I've been working with it for a couple of months now and am 'starting' to get the hang of it.

    I'll start reading up on Razor (thank you for the links) and will look to move everything over if all looks good.

    In the mean time, I'm unfortunately on a bit of a deadline to get the school site ready for next term so I need to get something working as quickly as possible either in XSLT or Razor (if I understand it in time).

    Thanks again forthe advice

  • Markus Johansson 1938 posts 5866 karma points MVP 2x c-trib
    Oct 05, 2011 @ 10:31
    Markus Johansson
    0

    So you want the "ClassDetailsArea" for which the ClassYear = 'Yead 1'?

    This is the XSLT to use:

    /MyClassArea/ClassDetailsArea [classYear = 'Year 1']

Please Sign in or register to post replies

Write your reply to:

Draft