0

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.

3
  • This question is not clear enough either. Where are you having difficulties? Can you post examples of what you are trying to do? Commented Jun 13, 2011 at 19:37
  • 1
    XSLT Is normally used to transform xml documents to another representation. It does not hold information by itself. Have you meant xml which will be transformed by xslt to e.g. HTML? Commented Jun 13, 2011 at 19:39
  • 1
    You would apply the xslt via System.Xml.Xsl.XslCompiledTransform - not sure how javascript factors in this, though Commented Jun 13, 2011 at 19:39

2 Answers 2

1

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>
Sign up to request clarification or add additional context in comments.

2 Comments

If you're going to post code, you should try to include likely vocabulary from the question (in this case stock prices) as opposed to less relevant vocabulary (in this case CD collection).
Basically, I'm trying to do something like this:wackylabs.net/2007/10/… It's the second method...and I just can't figure out what they're wanting me to do. Where do I put the XsltArgumentList args part of the code?
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.