XSL delivers an unwanted bonus

XSL delivers an unwanted bonus

am 25.10.2007 21:19:03 von AlBruAn

I have an app wherein I need to transform some XML using an XSL Stylesheet.
Everything works great until the end of the template is reached.

My template is as follows:



xmlns:xsl="http://www.w3.org/1999/XSL/Transform">






















,











Dear
:



















Overpayment ID

Overpayment Amount

Reason









Your friends at BCBST








My data is as follows:


1
10/25/2007
First
Middle
Last
123 Main St
Chattanooga
TN
37343
USA


1
100
Coding Error


2
200
Coding Error


3
300
Coding Error



Intended output is:
10/25/2007

First Middle Last
123 Main St
Chattanooga, TN 37343 USA



Dear First:

Overpayment ID Overpayment Amount Reason
1 100 Coding Error
2 200 Coding Error
3 300 Coding Error

Your friends at BCBST


I get the output listed above when I transform the data, but the "bonus" I
mentioned comes in the form of a line reading "1 100 Coding Error 2 200
Coding Error 3 300 Coding Error" on the line below the phrase "Your friends
at BCBST". This line gets put there when the parser hits the
line. Is there any cause for this to occur?

Allen

Re: XSL delivers an unwanted bonus

am 26.10.2007 00:19:12 von Anthony Jones

"AlBruAn" wrote in message
news:4DD6DCB2-8895-47BA-A9D4-0D2734F0979A@microsoft.com...
> I have an app wherein I need to transform some XML using an XSL
Stylesheet.
> Everything works great until the end of the template is reached.
>
> My template is as follows:
>
>
>
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
>
>
>
>
>
>
>
>
>
>

>

>
>
>
>

>
>

> ,
>
>
>
>

>

>

>

> Dear
> :
>

>

>
>


>
>
>
>
>
>
>

>
>
>
>
>
>

> Overpayment ID
>

> Overpayment Amount
>

> Reason
>

>
>

>
>

>
>

>

> Your friends at BCBST
>

>
>
>
>
>
>
>
> My data is as follows:
>
>

> 1
> 10/25/2007
> First
> Middle
> Last
> 123 Main St
> Chattanooga
> TN
> 37343
> USA
>

>
> 1
> 100
> Coding Error
>

>
> 2
> 200
> Coding Error
>

>
> 3
> 300
> Coding Error
>

>

>
> Intended output is:
> 10/25/2007
>
> First Middle Last
> 123 Main St
> Chattanooga, TN 37343 USA
>
>
>
> Dear First:
>
> Overpayment ID Overpayment Amount Reason
> 1 100 Coding Error
> 2 200 Coding Error
> 3 300 Coding Error
>
> Your friends at BCBST
>
>
> I get the output listed above when I transform the data, but the "bonus" I
> mentioned comes in the form of a line reading "1 100 Coding Error 2 200
> Coding Error 3 300 Coding Error" on the line below the phrase "Your
friends
> at BCBST". This line gets put there when the parser hits the

> line. Is there any cause for this to occur?
>

This question would have been better placed in the XSL group but I'll answer
it here.

You've matched /letter/header. Your template does it stuff. Then the
processor continues and finds a set of overpayment nodes which not matching
any template gets the default treament of the text content being output.

The top template should match just the root node in the document (ie
/letter) that way that template controls all the processing.


--
Anthony Jones - MVP ASP/ASP.NET