Jump to content

nobitavn94

Members
  • Posts

    33
  • Joined

  • Last visited

Posts posted by nobitavn94

  1. Here are some code :function getXMLHTTPRequest(){var xmlHttp;// if running Internet Explorerif(window.ActiveXObject){try{xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}catch (e){xmlHttp = false;}}// if running Mozilla or other browserselse{try{xmlHttp = new XMLHttpRequest();}catch (e){xmlHttp = false;}}// return the created object or display an error messageif (!xmlHttp)alert("Error creating the XMLHttpRequest object.");elsereturn xmlHttp;}function getOnlineClass(){var url = 'http://localhost/MyOnlineClass?sql=SELECT* from LOP FOR XML AUTO &root=DSLOP';http.open("GET", url, true);http.onreadystatechange = useHttpResponse;http.send(null);}var http = getXMLHTTPRequest();http.async =true;function useHttpResponse(){ if (http.readyState == 4) { if(http.status == 200){ var doc =http.responseXML ;document.getElementById("txtArea").innerText=doc.DocumentElement.FirstChild.Attributes["MaLop"].Value;}}else {}}

  2. Hi all !I'm using AJAX+HTTP object to query data from SQL Server .And I want the result is a XML file.But the responseXML property of XMLHttpResquest is null,whereas responseText property contains the content of a XML file (a XML string ).I wonder if I made any mistakes .Can any one help me ?Thanks.

  3. I follow your code ,but it doesn't work. Then , the link each text inside td tag like this:"..../showCatalog?id='$id' " . I want $id store <xsl:value-of select="Id"/> value .I wonder if I made mistakes anywhere .Thanks !

    I follow your code ,but it doesn't work. Then , the link each text inside td tag like this:"..../showCatalog?id='$id' " . I want $id store <xsl:value-of select="Id"/> value .I wonder if I made mistakes anywhere .Thanks !
  4. First of all, you adress a variable by the value of the name attribute, not the name attribute itself. So you should adress this variable with "$id", not "$name".Also, a local variable (one inside a template) is only available to it's siblings and descendants. Scince in this example the variable is a child of a <td>, it's available only to that <td> and further down.To make it accessable to other cells, simply move it at least one level above. In other words, create it inside a <tr> like this:
    <xsl:for-each select="NewDataSet/Table"><tr><xsl:variable name="id" select="Id" /><td style="font-family: Verdana;font-size : 8pt;color:blue"><xsl:value-of select="Id"/>.</td><td> <a href="showCatalog.aspx?id='$id'" class="catalogLink" ><xsl:value-of select="Name"/> </a></td></tr> </xsl:for-each>

    If that for-each generated more then one row, you may even create the variable as a sibling to the row like this:

    <xsl:for-each select="NewDataSet/Table"><xsl:variable name="id" select="Id" /><tr><td style="font-family: Verdana;font-size : 8pt;color:blue"><xsl:value-of select="Id"/>.</td><td> <a href="showCatalog.aspx?id='$id'" class="catalogLink" ><xsl:value-of select="Name"/> </a></td></tr> </xsl:for-each>

    Scince all of those are created for each NewDataSet/Table node, the result is the same.

    I follow your code ,but it doesn't work. Then , the link each text inside td tag like this:"..../showCatalog?id='$id' " . I want $id store <xsl:value-of select="Id"/> value .I wonder if I made mistakes anywhere .Thanks !I follow your code ,but it doesn't work. Then , the link each text inside td tag like this:"..../showCatalog?id='$id' " . I want $id store <xsl:value-of select="Id"/> value .I wonder if I made mistakes anywhere .Thanks !
  5. I'm new in XSLT.I want to use avariable to store Id as a parameter like this :<xsl:for-each select="NewDataSet/Table"> <tr> <td style="font-family: Verdana;font-size : 8pt;color:blue"> <xsl:variable name="id" select="Id" /> <xsl:value-of select="Id"/>. </td> <td> <a href="showCatalog.aspx?id='$name'" class="catalogLink" ><xsl:value-of select="Name"/> </a> </td> </tr> </xsl:for-each>but this code doesn't work properly.Can any one help me ?Thanks you very much !

×
×
  • Create New...