Copied to clipboard

Flag this post as spam?

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


  • bsod99 1 post 21 karma points
    Dec 05, 2012 @ 17:05
    bsod99
    0

    Retrieving document types in xslt file in umbraco

    Very new to Umbraco and .net, have been getting on fairly well putting my first site together. However, I've hit a bit of a stumbling block where I have set up a document type called Testimonial Article, which I want to retrieve and loop through in the XSLT file. I have set up a Macro which is linked to this XSLT file, and I've created and published a Testimonial Article - but there is no results seemingly.

    I am assuming I am trying to access the document type incorrectly in the XSLT file?

    In Testimonials.xslt, very basic:

    <xsl:param name="currentPage"/>
    
    <xsl:template match="/">
    <xsl:for-each select="umbraco.library:GetXmlAll()//node[@nodeTypeAlias = 'TestimonialArticle']" >
        <p>Result</p>
    </xsl:for-each>
    
    </xsl:template>

    I have created a Testimonial with document type Testimonial Article:



  • Charles Afford 1163 posts 1709 karma points
    Jan 03, 2013 @ 22:32
    Charles Afford
    0

    Hi,  What properties are you trying to access on Testimonal Article?  and why are you trying to get all of the xml at once?

    If you just want to get a value from a property for say a textstring just do <xsl:value-of select=$currentPage/nodeproperty></xsl>

    $currentPage is the node you are currently at and nodeProperty is the alias of the property you are trying to access.

    hope this helps.  If you are trying to get xml of a particualr doc type let me know and i will give you some code :)

  • Charles Afford 1163 posts 1709 karma points
    Jan 03, 2013 @ 22:36
    Charles Afford
    0

    you can see all of the XML markup for a page by doing <textarea><xsl:copy-of="$currentPage"></xsl:copy-of></textarea>

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Jan 04, 2013 @ 00:32
    Chriztian Steinmeier
    0

    Hi bsod99,

    I just updated the GetXmlAll() page to be of a little more help to newcomers looking up what to do. Basically, you don't need it from XSLT - there's a couple of examples of how to do what I've typically seen people do, but with straight XPath instead. Hope it helps - otherwise, come back here :-)

    Also, Charles' tip on viewing the XML can be very helpful to get a grasp on how the data is structured for use in your macros.

    I created a package for making that particular thing a bit easier: XML Dump makes it easy to view and query the XML directly from the browser's address bar.

    /Chriztian

  • 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