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 6:45:00 PM

What a terrible XML representation...
Anyway I don't know how much you need but to select the A: types you need:
/message/text[starts-with(., 'A:')]
and for B: ones:
/message/text[starts-with(., 'B:')]
So create an XSLT that use xsl:apply-templates to these two selections. In a 
matching template for A:
<xsl:template match="text[starts-with(., 'A:']">
you can add the HTML markup and similarly for the B: group.


-- 

Joe Fawcett -  XML MVP


http://joe.fawcett.name
"hoosie" <hoosiemama@g...> wrote in message 
news:1160068248.047346.177960@i......
>I am trying to process a list of error messages of two different types.
> They arrive as such:
>
> <message>
>      <text>A:SOMEERROR</text>
>      <text>A:SOMEOTHER</text>
>      <text>B:ANOTHER</text>
>      <text>A:ANDANOTHER</text>
> </message>
>
> The error type is denoted by a code like A or B followed by a colon and
> some other descriptor.  There can only be 1 type B error, and what I
> need to do in pseudocode would be:
>
> {
> If there are any A errors, draw a yellow box
>     for each A error, write the text into the box
> end if
>
> If B error, write a bunch of static HTML
> }
>
> I am quite stumped as to how to do this, as it involves iterating
> through the list once before to find out if there are any type A errors
> (ie draw the box), and I am pretty new to XSL, and I don't know whether
> to use variables, keys, templates, etc.  Any help GREATLY appreciated!
>
> Thanks, Ian
> 




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