Stock Quote using XML Web service

Click Add an XML file

 

Name the Data Source

Type the URL of XML

 

Click don’t attempt to authenticate

Click the down arrow and click show data and use the data which you want to incorporate in your Page

————————————–

Code Example:

<WebPartPages:DataFormWebPart runat=”server” IsIncluded=”True” FrameType=”None” NoDefaultStyle=”TRUE” ViewFlag=”0″ Title=”One” __markuptype=”vsattributemarkup” __WebPartId=”{38C235A4-2ACD-4564-B06B-9D0E8F29002C}” id=”g_38c235a4_2acd_4564_b06b_9d0e8f29002c” __AllowXSLTEditing=”true” WebPart=”true” Height=”” Width=””>
 <DataSources>
  <SharePoint:XmlUrlDataSource runat=”server” id=”One1″ selectcommand=”http://xml=quotes” AuthType=”None”/>
 </DataSources>
 <ParameterBindings>
               <ParameterBinding Name=”dvt_apos” Location=”Postback;Connection”/>
               <ParameterBinding Name=”UserID” Location=”CAMLVariable” DefaultValue=”CurrentUserName”/>
               <ParameterBinding Name=”Today” Location=”CAMLVariable” DefaultValue=”CurrentDate”/>
              </ParameterBindings>
 <datafields>@PrimaryTicker,PrimaryTicker;@DisplayInDropdown,DisplayInDropdown;@SecurityID,SecurityID;@Company,Company;@Ticker,Ticker;@DisplayTicker,DisplayTicker;@Exchange,Exchange;@Currency,Currency;@CurrencyLabel,CurrencyLabel;@CurrencyLabelSuffix,CurrencyLabelSuffix;@Type,Type;@Class,Class;@FirstTradeDate,FirstTradeDate;@FinancialStatusIndicator,FinancialStatusIndicator;Trade;Change;Bid;Ask;BidSize;AskSize;High;Low;Volume;Open;PreviousClose;FiftyTwoWeekHigh;FiftyTwoWeekLow;PERatio;MarketCap;SharesOutstanding;RollingEPS;Date/@Date,Date/Date;Date/@Time,Date/Time;Date/text(),Date;FiftyTwoWeekHighDate/@Date,FiftyTwoWeekHighDate/Date;FiftyTwoWeekHighDate/@Time,FiftyTwoWeekHighDate/Time;FiftyTwoWeekHighDate/text(),FiftyTwoWeekHighDate;FiftyTwoWeekLowDate/@Date,FiftyTwoWeekLowDate/Date;FiftyTwoWeekLowDate/@Time,FiftyTwoWeekLowDate/Time;FiftyTwoWeekLowDate/text(),FiftyTwoWeekLowDate;</datafields>
 <XSL>
<xsl:stylesheet version=”1.0″ exclude-result-prefixes=”xsl msxsl ddwrt” xmlns:ddwrt=”http://schemas.microsoft.com/WebParts/v2/DataView/runtime” xmlns:asp=”http://schemas.microsoft.com/ASPNET/20” xmlns:__designer=”http://schemas.microsoft.com/WebParts/v2/DataView/designer” xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” xmlns:msxsl=”urn:schemas-microsoft-com:xslt” xmlns:SharePoint=”Microsoft.SharePoint.WebControls” xmlns:ddwrt2=”urn:frontpage:internal”>
 <xsl:output method=”html” indent=”no”/>
 <xsl:decimal-format NaN=””/>
 <xsl:param name=”dvt_apos”>&apos;</xsl:param>
 <xsl:variable name=”dvt_1_automode”>0</xsl:variable>
 <xsl:template match=”/”>
  <xsl:call-template name=”dvt_1″/>
 </xsl:template>
 <xsl:template name=”dvt_1″>
     <xsl:variable name=”dvt_StyleName”>Table</xsl:variable>
     <xsl:variable name=”Rows” select=”/IRXML/StockQuotes/Stock_Quote” />
     <table border=”0″ cellpadding=”2″ cellspacing=”0″ style=”width: 121px”>
   <tr valign=”top”>
       <xsl:if test=”$dvt_1_automode = ‘1’” ddwrt:cf_ignore=”1″>
     <th width=”1%” nowrap=”nowrap” />
    </xsl:if>
         </tr>
         <xsl:call-template name=”dvt_1.body”>
             <xsl:with-param name=”Rows” select=”$Rows” />
         </xsl:call-template>
     </table>
 </xsl:template>
 <xsl:template name=”dvt_1.body”>
     <xsl:param name=”Rows” />
     <xsl:for-each select=”$Rows”>
         <xsl:call-template name=”dvt_1.rowview” />
     </xsl:for-each>
 </xsl:template>
 <xsl:template name=”dvt_1.rowview”><tr>
      <xsl:if test=”position() mod 2 = 1″>
          <xsl:attribute name=”class”>ms-alternating</xsl:attribute>
      </xsl:if>
      <xsl:if test=”$dvt_1_automode = ‘1’” ddwrt:cf_ignore=”1″>
    <td width=”1%” nowrap=”nowrap”>
     <span ddwrt:amkeyfield=”” ddwrt:amkeyvalue=”string($XPath)” ddwrt:ammode=”view” />
    </td>
   </xsl:if>
      <td style=”width: 27px”>GMG</td>
      
   <td>A$<xsl:value-of select=”Trade” /></td>
   <td>
    <xsl:value-of select=”@FinancialStatusIndicator” /><xsl:value-of select=”@FinancialStatusIndicator” /><xsl:value-of select=”format-number(@FinancialStatusIndicator, &quot;#,##0.;#,##0. -&quot;)” /><xsl:value-of select=”format-number(Change, &quot;+#,##0.00;-#,##0.00&quot;)” /></td>

Post a comment or leave a trackback: Trackback URL.

Leave a comment