Copied to clipboard

Flag this post as spam?

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


  • Kasper Dyrvig 246 posts 379 karma points
    Jun 30, 2010 @ 12:56
    Kasper Dyrvig
    0

    New in XSLT and Umbraco - how do these work?

    This may not be a hard question for you guys, but to me this is a big deal. I'm new to Umbraco and XSLT - but I can see that this is a smart way to do websites.

    My question is: How do I get data from a XML-file into the XSLT and display the data? How do I link them together?

    I hope to get a answer quick - I have worked with this in 3 days now!

    Thank you

  • Rich Green 2246 posts 4006 karma points
    Jun 30, 2010 @ 13:07
    Rich Green
    0

    Hi,

    Watch the 5 free videos here http://umbraco.tv/documentation/videos/for-site-builders/foundation/document-types and all should become clear. If you know a little about Umbraco you can just skip to the "Creating your first XSLT macro" video.

    Best of luck

    Rich


  • Kasper Dyrvig 246 posts 379 karma points
    Jun 30, 2010 @ 13:15
    Kasper Dyrvig
    0

    I have allready seen those... I don't think they describe fx where to put the XML-file, and how the data from the XML come into the XSLT. Or is it me who are stupid?

  • Rich Green 2246 posts 4006 karma points
    Jun 30, 2010 @ 13:24
    Rich Green
    2

    The XML file is automatically generated for you so you don't need to put it anywhere..

    With regards to XSLT the complete XML document of the published site gets put into a variable named "currentPage" you can use this variable within your XSLT file to access the XML.

    To get a further understanding you can read all about  umbraco, currentPage and XSLT here http://umbraco.org/documentation/books/xslt-basics/understanding-currentpage

    If you have downloaded Umbraco 4.5 in the last week or so you should also note that most of the documentation you find will not be up to date as the XML schema has changed slightly. You can however get 4.5 to output the old schema so don't let this worry you.

    Rich


     

     

     

  • Anders Burla Johansen 2560 posts 8256 karma points
    Jun 30, 2010 @ 13:26
    Anders Burla Johansen
    0

    The xml is genereated by umbraco at every page view where you can both access currentPage xml and also use some of the build in xslt extentions to get xml from other douments or media. Then you use xslt til parse the xml into html that make up your website.

  • Kasper Dyrvig 246 posts 379 karma points
    Jun 30, 2010 @ 13:36
    Kasper Dyrvig
    0

    What if I need other data than Umbraco provides? Fx a list of my DVDs. Insted of creating a page that I should update every time I buy a new DVD, I would like to have the information in XML.

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Jun 30, 2010 @ 13:44
    Dirk De Grave
    0

    You can still use "external data" in your umbraco website. If you can find a way to return an XmlDocument from your sql query (if you store info in your db), then you could quite easily use xslt to display a list of all dvd's in your database.

    For example, you could write your own xslt extension which grabs the dvd list from your datasource (whatever that may be) and use xslt/xpath to transform that list to show on your website. You'll find info on xslt extensions (how to build/install/use) in the wiki section

     

    Hope this helps.

    Regards,

    /Dirk

  • Kasper Dyrvig 246 posts 379 karma points
    Jun 30, 2010 @ 13:59
    Kasper Dyrvig
    0

    Okay, thanks for your replies!

    I really this will work out...

  • Rich Green 2246 posts 4006 karma points
    Jun 30, 2010 @ 14:18
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies