开发者

Write C# code in XSLT file

开发者 https://www.devze.com 2023-03-12 21:53 出处:网络
I\'m currently using a Google Stock API to retrieve information from the internet about stocks. (Done in C#). The C# code retrieves all the values. I then want to be able to display this information (

I'm currently using a Google Stock API to retrieve information from the internet about stocks. (Done in C#). The C# code retrieves all the values. I then want to be able to display this information (which includes a few doubles and a string that links to an image) in my .开发者_高级运维XSLT file (using JavaScript). How would I go about doing this? I've tried looking on Google, but nothing seems clear enough to me.


Your question is quite confusing, but I am guessing this is what your looking for?

<%
string artist = "some artist";
string title = "some title";
%>
<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
  <body>
    <h2>My CD Collection</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
        <th>Title</th>
        <th>Artist</th>
      </tr>
      <xsl:for-each select="catalog/cd">
        <tr>
          <td><xsl:value-of select="<%=title%>"/></td>
          <td><xsl:value-of select="<%=artist%>"/></td>
        </tr>
      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>


Use CDATA section in your XSLT with language specified as C#.

I am sure you can use Javascript in the CDATA. I am guessing C# is also supported.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号