This post is a follow on from http://social.msdn.microsoft.com/Forums/en-US/a09289f0-6579-4398-a4d0-e48c46217163/xslt-how-to-select-below-one-level-
I am unable to get any output from this sample code, i can't undertsand what the issue is .
The output has the test but does not find any @outcome values.
I have tried C# as well as msxls.exe
>> I would appreciate an experts gotchya help here as it "seems" to be all ok
XML In
Filename xml_sample.xml
<?xml version="1.0" encoding="utf-8"?><TestRun xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><TestSettings></TestSettings><Times></Times><ResultSummary><Counters></Counters><RunInfos><Runinfo outcome="Warming1"></Runinfo><Runinfo outcome="Warming2"></Runinfo><Runinfo outcome="Warming3"></Runinfo></RunInfos></ResultSummary></TestRun>
XSL file - sample.xsl
<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"><html><body><h2>GN4 User Information</h2><table border="1"><tr bgcolor="#9acd32"><th>OutCome</th><!--<th>User Complete Name</th>--></tr><xsl:for-each select="TestRun/ResultSummary/RunInfos/RunInfo"><tr><td> OutCome=<xsl:value-of select="@outcome"/></td></tr></xsl:for-each></table></body></html></xsl:template></xsl:stylesheet>
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; using System.Xml.XPath; using System.Xml.Xsl; namespace XMLTest { class Program { static void Main(string[] args) { string path = @"D:\Projects\XLSTProcessing\xml_sample.xml"; // Load the style sheet. XslCompiledTransform xslt = new XslCompiledTransform(); xslt.Load((string)@"D:\Projects\XLSTProcessing\sample.xsl"); // Execute the transform and output the results to a file. xslt.Transform(path, @"D:\Projects\XLSTProcessing\sample.htm");