Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XSLT not working
Message
De
06/09/2005 15:54:27
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Titre:
XSLT not working
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01047145
Message ID:
01047145
Vues:
57
This VFP code works just fine:
    oxmlHTTP = CreateObject( "Microsoft.XMLHTTP" )
    cURL = "http://news.google.com/news?hl=en&ned=us&q=hurricane+Katrina&ie=UTF-8&scoring=d&output=rss"
    oxmlHTTP.Open( "GET", m.cURL, .F. )
    oxmlHTTP.Send()

    oRSS = CreateObject( "Microsoft.XMLDOM" )
    oRSS.async = .F.
    oRSS.loadXML( oxmlHTTP.ResponseText )

    oXSLT = CreateObject( "Microsoft.XMLDOM" )
    oXSLT.async = .F.
    oXSLT.load( "xslt2.xsl" )

    STRTOFILE( oRSS.transformNode( oXSLT ), "rss.html" )
=============================

This JavaScript call inside of HTML does not but is nearly identical to above code. All I am doing it double clicking on the the HTML file and it should return results similar to doing the above VFP code but it does not.
<html>
 <head>
  <script type="text/javascript" language="javascript">
    function getRSS()
     {
       var cURL ;
       var oXMLHTTP ;
       var oXMLHTTP = new ActiveXObject( "Microsoft.XMLHTTP" ) ;
       cURL = "http://news.google.com/news?hl=en&tab=wn&ie=UTF-8&scoring=d&q=Hurricane+Katrina&output=rss";
       oXMLHTTP.Open( "GET", cURL, false ) ;
       oXMLHTTP.Send() ;
       
       var oXML;
	   oXML = new ActiveXObject( "Microsoft.XMLDOM" ) ;
       oXML.async = false ;       
       oXML.load( oXMLHTTP.responseText ) ;
       
       var oXSLT ;
       var oXSLT = new ActiveXObject( "Microsoft.XMLDOM" ) ;
       oXSLT.async = false ;
       oXSLT.load( "xslt2.xsl" ) ;
       
       // divDisplay.innerHTML = oXMLHTTP.responseText;  -- this line works, next line does not
       divDisplay.innerHTML = oXML.transformNode( oXSLT ) ; 
     }
   </script>    
 </head>
                       
 <body onload="getRSS()">
   <div id="divDisplay"></div> 
   <p>This is a test</p>
 </body>
</html>
=================================

Here is the XSLT contents inside of the xslt2.xsl file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>

  <xsl:template match="/rss">
    <dl style="padding-right:1em">
      <xsl:for-each select="channel/item">
        <xsl:if test="position() < 3">
          <dd>
            <xsl:element name="a">
              <xsl:attribute name="href">
                <xsl:value-of select="link"/>
              </xsl:attribute>
            </xsl:element>
          </dd>
          <dt>
            <xsl:value-of select="description" disable-output-escaping="yes"/> 
          </dt>
        </xsl:if>
      </xsl:for-each>
    </dl>
  </xsl:template>
</xsl:stylesheet>
==========================

Can anyone help me getting the Javascript code to run?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform