Copied to clipboard

Flag this post as spam?

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


  • nnp 1 post 21 karma points
    Mar 22, 2012 @ 22:40
    nnp
    0

    xslt transformation of xml file retrieved from web site

    i want to apply xslt transformation to a xml file , retrieved from another web server (web site). i dont know how to do this in umbraco. here is my xslt.

    <xsl:template match="/"> <ul> <xsl:for-each select="result/job"> <li> <xsl:value-of select="category"/> </li> </xsl:for-each> </ul>

     

    and source of the xml file will be like this.

     

    http://www.somesite.com/xml.aspx

    i am totally new at umbraco

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Mar 22, 2012 @ 23:11
    Chriztian Steinmeier
    0

    Hi nnp,

    Here's the most basic way to do it:

       <xsl:template match="/">
            <xsl:variable name="data" select="umbraco.library:GetXmlDocumentByUrl('http://somesite.com/page', 20)" />
            <ul>
                <xsl:for-each select="$data//job">
                    <li><xsl:value-of select="category" /></li>
                </xsl:for-each>
            </ul>
        </xsl:template>
    
    The bold parts are what you need to change depending on your XML source - "20" is a cache duration (so Umbraco won't load the document from the server all the time - it's measured in seconds if I remember correct).

    /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