Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Vexing problem processing a list of error messages [Thread Next] Re: Vexing problem processing a list of error messagesTo: NULL Date: 10/5/2006 10:48:00 PM "hoosie" <hoosiemama@g...> wrote in message news:1160075134.913965.163830@k...... > Joe Fawcett wrote: >> What a terrible XML representation... > > Thanks Joe, with your help I'm making some progress. It truly is an > irritating representation, the list should have been split under two > nodes in the first place. > > I am having two strange problems though right now (I am using Cooktop > to test this). First is that the template is returning the opposite of > what I expect. When I run the code below my result is all of the A: > text, not the MG: text which is what I thought I was matching. > > Secondly, If I try to put a second template below this one, my output > is blank. Is there a limit on how many templates can use which nodes? > > Thanks again, Ian > > With input: > > <?xml version="1.0" encoding="utf-8"?> > <message> > <text>A:SOMEERROR</text> > <text>A:SOMEOTHER</text> > <text>MG:ANOTHER</text> > <text>A:ANDANOTHER</text> > </message> > > and 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="text[starts-with(., 'MG:')]"> > <xsl:for-each select="text"> > <xsl:value-of select="text"/> > </xsl:for-each> > </xsl:template> > </xsl:stylesheet> > > OUPUT in CookTop: > > A:SOMEERRORA:SOMEOTHERA:ANDANOTHER > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <xsl:apply-templates select="message/text"> <xsl:sort data-type="text" select="."/> </xsl:apply-templates> </body> </html> </xsl:template> <xsl:template match="text[starts-with(., 'A:')]"> <div style="border: 3px solid yellow"> <xsl:value-of select="."/> </div> </xsl:template> <xsl:template match="text[starts-with(., 'MG:')]"> <div>Some static text.</div> </xsl:template> </xsl:stylesheet> -- Joe Fawcett - XML MVP http://joe.fawcett.name | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
