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
    0

    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;"> ]>
    <xsl:stylesheet
     version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       xmlns:msxml="urn:schemas-microsoft-com:xslt"
       xmlns:umbraco.library="urn:umbraco.library"
       xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon"
       xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"
       xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath"
       xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"
       xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
       xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
       xmlns:CWS.Twitter="urn:CWS.Twitter"
       xmlns:georss="http://www.georss.org/georss"
       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('http://twitter.com/statuses/user_timeline/', data[@alias='contactTwitter'] ,'.xml?count=',1)"/>
     <xsl:apply-templates mode="tweet" select="umbraco.library:GetXmlDocumentByUrl($twitterXMLUrl)//statuses/status" />
    <div class="contact">

      <p>
        <h1>Hej, mitt namn är <xsl:value-of select="data[@alias='contactName']"/></h1>
        <p>
        <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"/>
        </p>
        <p>
        <xsl:value-of select="data[@alias='contactTitle']"/><br />
        <xsl:value-of select="data[@alias='contactPhone']"/><br />
        <xsl:value-of select="data[@alias='contactPhone2']"/><br />
        <a>
        <xsl:attribute name="href">
        <xsl:text>mailto:</xsl:text>
        </xsl:attribute>
        <xsl:value-of select="data[@alias='contactMail']"/>
        </a>
        </p>
      </p>
    </div>
    <hr/>
    </xsl:for-each>
    </div>
    </xsl:template>

    </xsl:stylesheet>

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Jun 18, 2010 @ 22:11
    Matt Brailsford
    0

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

    Matt

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Jun 20, 2010 @ 16:20
    Warren Buckley
    0

    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.

    Warren

Please Sign in or register to post replies

Write your reply to:

Draft