Copied to clipboard

Flag this post as spam?

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

  • Kalle Ekstrand 181 posts 259 karma points c-trib
    Jun 18, 2010 @ 21:42
    Kalle Ekstrand

    Easiest way to implement in an already existing XSLT-file?

    Hi there,

    I am looking for the easiest way to implement without using a macro inside an already existing XSLT-file.
    Or is it possible to call macro from inside XSLT?

    This is my existing code:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
       exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets CWS.Twitter georss">
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:template match="/">
    <div id="contactList" >
    <xsl:for-each select="$currentPage/node">
     <xsl:variable name="twitterXMLUrl" select="concat('', data[@alias='contactTwitter'] ,'.xml?count=',1)"/>
     <xsl:apply-templates mode="tweet" select="umbraco.library:GetXmlDocumentByUrl($twitterXMLUrl)//statuses/status" />
    <div class="contact">

        <h1>Hej, mitt namn är <xsl:value-of select="data[@alias='contactName']"/></h1>
        <xsl:value-of select="data[@alias='contactDesc']" /><br />
        Eller som han säger i sitt senaste inlägg på Twitter: <xsl:value-of select="CWS.Twitter:FormatUrls(text)" disable-output-escaping="yes"/>
        <xsl:value-of select="data[@alias='contactTitle']"/><br />
        <xsl:value-of select="data[@alias='contactPhone']"/><br />
        <xsl:value-of select="data[@alias='contactPhone2']"/><br />
        <xsl:attribute name="href">
        <xsl:value-of select="data[@alias='contactMail']"/>


  • Matt Brailsford 2363 posts 11453 karma points MVP 6x c-trib
    Jun 18, 2010 @ 22:11
    Matt Brailsford

    If you make it a named template, you could include it in your other XSLT files, and use call-template?


  • Warren Buckley 2085 posts 4523 karma points MVP 6x admin hq c-trib
    Jun 20, 2010 @ 16:20
    Warren Buckley

    Like Matt said you could use it as an xsl:include or you could just tweak the original twitter xslt to inlcude your custom markup or similarly copy the twitter code into your custom XSLT.


Please Sign in or register to post replies

Write your reply to: