Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Vexing problem processing a list of error messages

From: "Joe Fawcett" <joefawcett@---------.------>
To: 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 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent