EDN Admin
Well-known member
Im transforming XML to HTML. I have a loop in the XSLT that creates line indentations in the HTML by reading an integer value from an element attribute which indicates how many non-breaking spaces to insert into that line. Here is the loop:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; template <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; for-loop<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; param <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; count<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; param <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; indent<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; if <span style="color:Red; test<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; $count <= $indent<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; text<span style="color:Blue; > <span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; text<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; call-template <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; for-loop<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; with-param <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; count<span style="color:Black; " <span style="color:Red; select<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; $count + 1<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; with-param <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; indent<span style="color:Black; " <span style="color:Red; select<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; $indent<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; call-template<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; if<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; template<span style="color:Blue; >
[/code]
The loop will generate something like this in the HTML:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; td <span style="color:Red; width<span style="color:Blue; =<span style="color:Blue; "615" <span style="color:Red; colspan<span style="color:Blue; =<span style="color:Blue; "2" <span style="color:Red; valign<span style="color:Blue; =<span style="color:Blue; "top"<span style="color:Blue; ><span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; >(B)<span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Red;  <span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Red;  <span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; >are accessible on an Internet website <span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; </<span style="color:#A31515; td<span style="color:Blue; >
[/code]
We process tens of hundreds of HTML renditions from our source XML in this manner.
In the last two months we have come across a tiny smattering of HTML renditions (five so far) where one of the non-breaking space entities (  in a series will be missing its semicolon. Firefox is forgiving and seems to add the missing semicolon
for you. IE not so much. The end result being that   shows up in the browser as text.
This is what well end up with:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; td <span style="color:Red; width<span style="color:Blue; =<span style="color:Blue; "615" <span style="color:Red; colspan<span style="color:Blue; =<span style="color:Blue; "2" <span style="color:Red; valign<span style="color:Blue; =<span style="color:Blue; "top"<span style="color:Blue; ><span style="color:Red;  <span style="color:Red;   <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; >(B)<span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Red;  <span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Red;  <span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; >are accessible on an Internet website <span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; </<span style="color:#A31515; td<span style="color:Blue; >
[/code]
The third   in the series does not have the semicolon and thus shows up as text instead of white space.
I havent had any luck finding a similar situation on The Google. The occurrence appears to be random. The vast majority of our docs are fine and the vast majority of the sequences of non-breaking spaces are fine.
Could this be a bug in MSXML?
Any advice or insight would be appreciated. Using Visual Studio 2008 & .net framework v3.5
View the full article
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; template <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; for-loop<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; param <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; count<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; param <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; indent<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; if <span style="color:Red; test<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; $count <= $indent<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; text<span style="color:Blue; > <span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; text<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; call-template <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; for-loop<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; with-param <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; count<span style="color:Black; " <span style="color:Red; select<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; $count + 1<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; with-param <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; indent<span style="color:Black; " <span style="color:Red; select<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; $indent<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; call-template<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; if<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; template<span style="color:Blue; >
[/code]
The loop will generate something like this in the HTML:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; td <span style="color:Red; width<span style="color:Blue; =<span style="color:Blue; "615" <span style="color:Red; colspan<span style="color:Blue; =<span style="color:Blue; "2" <span style="color:Red; valign<span style="color:Blue; =<span style="color:Blue; "top"<span style="color:Blue; ><span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; >(B)<span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Red;  <span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Red;  <span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; >are accessible on an Internet website <span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; </<span style="color:#A31515; td<span style="color:Blue; >
[/code]
We process tens of hundreds of HTML renditions from our source XML in this manner.
In the last two months we have come across a tiny smattering of HTML renditions (five so far) where one of the non-breaking space entities (  in a series will be missing its semicolon. Firefox is forgiving and seems to add the missing semicolon
for you. IE not so much. The end result being that   shows up in the browser as text.
This is what well end up with:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; td <span style="color:Red; width<span style="color:Blue; =<span style="color:Blue; "615" <span style="color:Red; colspan<span style="color:Blue; =<span style="color:Blue; "2" <span style="color:Red; valign<span style="color:Blue; =<span style="color:Blue; "top"<span style="color:Blue; ><span style="color:Red;  <span style="color:Red;   <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Red;  <span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; >(B)<span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Red;  <span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Red;  <span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; u<span style="color:Blue; >are accessible on an Internet website <span style="color:Blue; </<span style="color:#A31515; u<span style="color:Blue; ><span style="color:Blue; </<span style="color:#A31515; td<span style="color:Blue; >
[/code]
The third   in the series does not have the semicolon and thus shows up as text instead of white space.
I havent had any luck finding a similar situation on The Google. The occurrence appears to be random. The vast majority of our docs are fine and the vast majority of the sequences of non-breaking spaces are fine.
Could this be a bug in MSXML?
Any advice or insight would be appreciated. Using Visual Studio 2008 & .net framework v3.5
View the full article