Click here to Skip to main content
15,889,116 members
Home / Discussions / C#
   

C#

 
QuestionHow to access XSL Vaiable in c#? Pin
Abubakarsb22-Feb-07 4:03
Abubakarsb22-Feb-07 4:03 
AnswerRe: How to access XSL Vaiable in c#? Pin
Pete O'Hanlon22-Feb-07 4:34
mvePete O'Hanlon22-Feb-07 4:34 
GeneralRe: How to access XSL Vaiable in c#? Pin
Abubakarsb22-Feb-07 4:51
Abubakarsb22-Feb-07 4:51 
GeneralRe: How to access XSL Vaiable in c#? Pin
Pete O'Hanlon22-Feb-07 5:05
mvePete O'Hanlon22-Feb-07 5:05 
GeneralRe: How to access XSL Vaiable in c#? Pin
Abubakarsb22-Feb-07 10:21
Abubakarsb22-Feb-07 10:21 
GeneralRe: How to access XSL Vaiable in c#? Pin
Pete O'Hanlon22-Feb-07 22:41
mvePete O'Hanlon22-Feb-07 22:41 
GeneralRe: How to access XSL Vaiable in c#? Pin
Abubakarsb22-Feb-07 23:53
Abubakarsb22-Feb-07 23:53 
GeneralRe: How to access XSL Vaiable in c#? Pin
Pete O'Hanlon23-Feb-07 0:23
mvePete O'Hanlon23-Feb-07 0:23 
Right, suppose that you have the following xslt file:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="testParam">Test value</xsl:param>
</xsl:stylesheet>


To read this in, you could do the following:

public void WriteToConsole()
{
  // Create a new XmlDocument.
  XmlDocument doc = new XmlDocument();
  // Load the Xslt file into the document.
  doc.Load("../../MyTest.xslt");
  // Create the namespace manager and load the document nametable.
  XmlNamespaceManager mgr = new XmlNamespaceManager(doc.NameTable);
  // If you don't add the xsl namespace in, you'll get errors attempting
  // to parse the document.
  string xsltMgr = "xsl";
  string xsltUri = "http://www.w3.org/1999/XSL/Transform";
  mgr.AddNamespace(xsltMgr, xsltUri);

  try
  {
    // Select the node that you want, and don't forget the namespace
    XmlNode node = doc.SelectSingleNode("//xsl:param[@name='testParam']", mgr);
    // Write out the inner text.
    Console.WriteLine(node.InnerText);
  }
  catch (Exception ex)
  {
    Console.WriteLine(ex.Message);
  }
}



the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer

Deja View - the feeling that you've seen this post before.

GeneralRe: How to access XSL Vaiable in c#? Pin
Abubakarsb23-Feb-07 2:35
Abubakarsb23-Feb-07 2:35 
GeneralRe: How to access XSL Vaiable in c#? Pin
Pete O'Hanlon23-Feb-07 4:01
mvePete O'Hanlon23-Feb-07 4:01 
GeneralRe: How to access XSL Vaiable in c#? Pin
Pete O'Hanlon26-Feb-07 4:47
mvePete O'Hanlon26-Feb-07 4:47 
GeneralRe: How to access XSL Vaiable in c#? Pin
Abubakarsb26-Feb-07 21:24
Abubakarsb26-Feb-07 21:24 
GeneralRe: How to access XSL Vaiable in c#? Pin
Abubakarsb28-Feb-07 10:13
Abubakarsb28-Feb-07 10:13 
GeneralRe: How to access XSL Vaiable in c#? Pin
Pete O'Hanlon28-Feb-07 10:52
mvePete O'Hanlon28-Feb-07 10:52 
GeneralRe: How to access XSL Vaiable in c#? Pin
Abubakarsb1-Mar-07 2:08
Abubakarsb1-Mar-07 2:08 
GeneralRe: How to access XSL Vaiable in c#? Pin
Pete O'Hanlon1-Mar-07 2:56
mvePete O'Hanlon1-Mar-07 2:56 
GeneralRe: How to access XSL Vaiable in c#? Pin
Abubakarsb1-Mar-07 3:09
Abubakarsb1-Mar-07 3:09 
GeneralRe: How to access XSL Vaiable in c#? Pin
Pete O'Hanlon1-Mar-07 4:01
mvePete O'Hanlon1-Mar-07 4:01 
GeneralRe: How to access XSL Vaiable in c#? Pin
Abubakarsb1-Mar-07 4:14
Abubakarsb1-Mar-07 4:14 
GeneralRe: How to access XSL Vaiable in c#? Pin
Abubakarsb4-Mar-07 9:49
Abubakarsb4-Mar-07 9:49 
GeneralRe: How to access XSL Vaiable in c#? Pin
Pete O'Hanlon8-Mar-07 2:31
mvePete O'Hanlon8-Mar-07 2:31 
GeneralRe: How to access XSL Vaiable in c#? Pin
Abubakarsb8-Mar-07 9:53
Abubakarsb8-Mar-07 9:53 
Questionwaveform generator compnenet needed! Plz help Pin
pashitech22-Feb-07 3:43
pashitech22-Feb-07 3:43 
AnswerRe: waveform generator compnenet needed! Plz help Pin
Pete O'Hanlon22-Feb-07 4:48
mvePete O'Hanlon22-Feb-07 4:48 
GeneralRe: waveform generator compnenet needed! Plz help Pin
pashitech22-Feb-07 19:40
pashitech22-Feb-07 19:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.