<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Help w/ XSLT</title><link>http://msmvps.com/blogs/williamryan/archive/2004/11/14/19157.aspx</link><description>Ok, what I'm trying to do is so simple that some 8th grader will probably answer this in 5 seconds and make me look like a big dummy. I have XML from a Dataset that's being piped into an XML Control on an ASP.NET Page. The document structure looks like</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>re: Help w/ XSLT</title><link>http://msmvps.com/blogs/williamryan/archive/2004/11/14/19157.aspx#19176</link><pubDate>Mon, 15 Nov 2004 03:07:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:19176</guid><dc:creator>William</dc:creator><description>Thanks KC.  I was just looking through examples trying to find zomething that worked.  I wasn't going to get there b/c that root note wasn't getting handled correctly Once you showed me that it 'clicked' and yes, the foreach seems to make a lot more sense and being able to navigate easily, which I can do now kicks a33. I can just imagine the possibilities with this stuff - I wished I'd have bit  the bullet a while ago but it will be fun to learn.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=19176" width="1" height="1"&gt;</description></item><item><title>re: Help w/ XSLT</title><link>http://msmvps.com/blogs/williamryan/archive/2004/11/14/19157.aspx#19173</link><pubDate>Mon, 15 Nov 2004 02:40:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:19173</guid><dc:creator>William</dc:creator><description>glad it worked Bill.&lt;br&gt;i made that mistake no less than 3 times when learning XSLT.&lt;br&gt;then it took me about 6 more months before i really understood it.&lt;br&gt;now it looks like XQuery is the chosen one.&lt;br&gt;i've read a couple books on it but haven't actually worked with it yet&lt;br&gt;&lt;br&gt;also, your 2nd XSLT post switched to using an xsl:for-each.&lt;br&gt;i consider that easier to understand than apply-templates,&lt;br&gt;because you can sort of think of it procedurally&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=19173" width="1" height="1"&gt;</description></item><item><title>re: Help w/ XSLT</title><link>http://msmvps.com/blogs/williamryan/archive/2004/11/14/19157.aspx#19169</link><pubDate>Mon, 15 Nov 2004 01:34:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:19169</guid><dc:creator>William</dc:creator><description>In addition you can find a few good examples here:&lt;br&gt;&lt;a target="_new" href="http://www.w3.org/TR/xslt#section-Document-Example"&gt;http://www.w3.org/TR/xslt#section-Document-Example&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;XSL rocks if you have something that implements it. It is basically &amp;quot;Parse this in the following way&amp;quot; which for anyone who has ever had to process entire XML documents ( just to see if the data you wanted is even in the doc and then base your logic on what you find ) XSL is a blessing. &lt;br&gt;&lt;br&gt;&lt;br&gt;*begin rant*&lt;br&gt;I have a 6kb XML parser for small devices using J2ME but it doesn't support XSL. Yet another place where Sun has really dropped the ball on small device work.&lt;br&gt;&lt;br&gt;Why the f#ck can't Research in Motion support C++ or C# ? I could save so much time and effort over using J2ME. They say they have a C++ API but there is zero documentation for it. I mean none, not even any docs explaining how to upload a C++ app to the device or what compiler they support, or how to find docs on getting a compiler set up to target their OS. I know it's not windows CE so WTF is it? They don't say. So I'm stuck with J2ME and a f#ck load of XML parsing vice being able to distill docs down using XSL.&lt;br&gt;*end rant*&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=19169" width="1" height="1"&gt;</description></item><item><title>re: Help w/ XSLT</title><link>http://msmvps.com/blogs/williamryan/archive/2004/11/14/19157.aspx#19165</link><pubDate>Mon, 15 Nov 2004 00:00:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:19165</guid><dc:creator>William</dc:creator><description>Let me restate that Casey - you are the man - that makes EVERYTHING so much easier that I'll actually get to go home this evening ;-)&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=19165" width="1" height="1"&gt;</description></item><item><title>re: Help w/ XSLT</title><link>http://msmvps.com/blogs/williamryan/archive/2004/11/14/19157.aspx#19164</link><pubDate>Sun, 14 Nov 2004 23:58:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:19164</guid><dc:creator>William</dc:creator><description>Casey:  You kick a33!  I sort of fixed part of the problem but I just took your code and it works like a charm - You are the MAN!&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=19164" width="1" height="1"&gt;</description></item><item><title>re: Help w/ XSLT</title><link>http://msmvps.com/blogs/williamryan/archive/2004/11/14/19157.aspx#19163</link><pubDate>Sun, 14 Nov 2004 23:57:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:19163</guid><dc:creator>William</dc:creator><description>The one thing I finally figured out is that the dsShoppingCartItem was causing the part of the problem.  I added this :&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot; ?&amp;gt;  to the top of the document and at first, nothing happened - then I realized I left a space to the left of the declaration.&lt;br&gt;&lt;br&gt;So this works perfectly for instance:&lt;br&gt;&lt;br&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; ?&amp;gt;&lt;br&gt;&amp;lt;xsl:stylesheet xmlns:xsl=&amp;quot;&lt;a target="_new" href="http://www.w3.org/1999/XSL/Transform&amp;quot;"&gt;http://www.w3.org/1999/XSL/Transform&amp;quot;&lt;/a&gt; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;xsl:template match=&amp;quot;/&amp;quot;&amp;gt;&lt;br&gt;&amp;lt;html&amp;gt;&lt;br&gt;  &amp;lt;body&amp;gt;&lt;br&gt;    &amp;lt;h2&amp;gt;This is killing me&amp;lt;/h2&amp;gt;&lt;br&gt;    &amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br&gt;    &amp;lt;tr bgcolor=&amp;quot;#9acd32&amp;quot;&amp;gt;&lt;br&gt;      &amp;lt;th align=&amp;quot;left&amp;quot;&amp;gt;DBAName&amp;lt;/th&amp;gt;&lt;br&gt;      &amp;lt;th align=&amp;quot;left&amp;quot;&amp;gt;Location&amp;lt;/th&amp;gt;&lt;br&gt;    &amp;lt;/tr&amp;gt;&lt;br&gt;   &amp;lt;xsl:for-each select=&amp;quot;dsShoppingCartItem/Location&amp;quot;&amp;gt;&lt;br&gt;    &amp;lt;tr&amp;gt;&lt;br&gt;      &amp;lt;td&amp;gt;&amp;lt;xsl:value-of select=&amp;quot;DBAName&amp;quot;/&amp;gt;&amp;lt;/td&amp;gt;&lt;br&gt;      &amp;lt;td&amp;gt;&amp;lt;xsl:value-of select=&amp;quot;TotalAmount&amp;quot;/&amp;gt;&amp;lt;/td&amp;gt;&lt;br&gt;    &amp;lt;/tr&amp;gt;&lt;br&gt;    &amp;lt;/xsl:for-each&amp;gt;&lt;br&gt;    &amp;lt;/table&amp;gt;&lt;br&gt;  &amp;lt;/body&amp;gt;&lt;br&gt;  &amp;lt;/html&amp;gt;&lt;br&gt;&amp;lt;/xsl:template&amp;gt;&lt;br&gt;&amp;lt;/xsl:stylesheet&amp;gt;&lt;br&gt;&lt;br&gt;Which is slightly different than my original post - but it was the traversal that caused at least one problem.  The thing that's weird w/ the XML Control is that if you change the root node and it doesn't find it, then it will simply output all of the text - so it looks like it's working but just finding the wrong stuff.&lt;br&gt;&lt;br&gt;When I did this with code instead of the control it made a lot more sense - not because the control is screwy but because I'm a bubble head.&lt;br&gt;&lt;br&gt;I will get this - XSLT looks way too cool to be lame at it.&lt;br&gt;&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=19163" width="1" height="1"&gt;</description></item><item><title>re: Help w/ XSLT</title><link>http://msmvps.com/blogs/williamryan/archive/2004/11/14/19157.aspx#19162</link><pubDate>Sun, 14 Nov 2004 23:52:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:19162</guid><dc:creator>William</dc:creator><description>&amp;lt;xsl:stylesheet xmlns:xsl=&amp;quot;&lt;a target="_new" href="http://www.w3.org/1999/XSL/Transform&amp;quot;"&gt;http://www.w3.org/1999/XSL/Transform&amp;quot;&lt;/a&gt; xmlns:xsd=&amp;quot;&lt;a target="_new" href="http://tempuri.org/dsShoppingCartItem.xsd&amp;quot;"&gt;http://tempuri.org/dsShoppingCartItem.xsd&amp;quot;&lt;/a&gt; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;xsl:template match=&amp;quot;xsd:dsShoppingCartItem&amp;quot;&amp;gt;&lt;br&gt;  Bill&lt;br&gt;  &amp;lt;xsl:apply-templates select=&amp;quot;xsd:Location&amp;quot;/&amp;gt;&lt;br&gt;&amp;lt;/xsl:template&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;xsl:template match=&amp;quot;xsd:Location&amp;quot;&amp;gt;&lt;br&gt;  &amp;lt;table width=&amp;quot;100%&amp;quot; border=&amp;quot;1&amp;quot;&amp;gt;&lt;br&gt;  &amp;lt;tr&amp;gt;&lt;br&gt;  &amp;lt;td&amp;gt;&lt;br&gt;  &amp;lt;b&amp;gt;&amp;lt;xsl:value-of select=&amp;quot;xsd:DBAName&amp;quot; /&amp;gt; &amp;lt;/b&amp;gt;&lt;br&gt;  &amp;lt;/td&amp;gt;&lt;br&gt;  &amp;lt;/tr&amp;gt;&lt;br&gt;  &amp;lt;/table&amp;gt;&lt;br&gt;&amp;lt;/xsl:template&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;/xsl:stylesheet&amp;gt;&lt;br&gt;&amp;lt;!--?xml-stylesheet type=&amp;quot;text/xsl&amp;quot; href=&amp;quot;bill.xslt&amp;quot;?--&amp;gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=19162" width="1" height="1"&gt;</description></item><item><title>re: Help w/ XSLT</title><link>http://msmvps.com/blogs/williamryan/archive/2004/11/14/19157.aspx#19160</link><pubDate>Sun, 14 Nov 2004 23:16:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:19160</guid><dc:creator>William</dc:creator><description>I'll like it to when I get the hang of it - but it's busting my b4lls right now.  Let me give that a try - I definitely appreciate it !&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=19160" width="1" height="1"&gt;</description></item><item><title>re: Help w/ XSLT</title><link>http://msmvps.com/blogs/williamryan/archive/2004/11/14/19157.aspx#19159</link><pubDate>Sun, 14 Nov 2004 23:12:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:19159</guid><dc:creator>William</dc:creator><description>an obvious problem is the XML namespaces dont match.&lt;br&gt;&lt;br&gt;declare a namespace in XSLT to match the one in XML, something like this:&lt;br&gt;xmlns:xsd=&amp;quot;&lt;a target="_new" href="http://tempuri.org/dsShoppingCartItem.xsd&amp;quot;"&gt;http://tempuri.org/dsShoppingCartItem.xsd&amp;quot;&lt;/a&gt;&lt;br&gt;&lt;br&gt;then when you are referring to an element in XSLT, use that prefix:&lt;br&gt;xsd:Location&lt;br&gt;&lt;br&gt;... and i like XSLT. its basically voodoo magic for XML&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=19159" width="1" height="1"&gt;</description></item></channel></rss>