Text alignment with xml:space="preserve"

Hi,

i've got two simple examples to show you my problem with xml:space="preserve". 
See examples after the description.

I read a lot about xml:space="preserve" but i could not identify what the 
reason of my problem is.

So example 1 illustrates the text where the alignment is ok but the three 
spaces are missing. 

Example 2 illustrates the text where the alignment of the text changes just by 
adding "xml:space="preserve" to the text element. The number of spaces are 
shown correctly.

Can anyone here explain me why setting xml:space leads to repositioning of the 
text? Is there another way (maybe by css) to show the correct number of spaces 
with the right text alignment?

Best Regards

Bert


Example 1:

<?xml version="1.0" encoding="iso-8859-1"?>

<svg contentScriptType="text/ecmascript" zoomAndPan="magnify"
     xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css"
     version="1.0" width="100%" preserveAspectRatio="xMidYMid meet"
     viewBox="0.0 -0.0 297.0 210.0" height="100%"
     xmlns="http://www.w3.org/2000/svg">
    <line y2="180.0px"
          style="fill: none; stroke: rgb(0, 0, 0); stroke-dasharray: 20 0; "
          x1="90.0px" x2="90.0px" y1="50.0px"/>
    <line y2="120.0px"
          style="fill: none; stroke: rgb(0, 0, 0); stroke-dasharray: 20 0; "
          x1="40.0px" x2="150.0px" y1="120.0px"/>
    <g>
        <rect x="90.0px" y="106.338px"
              width="134.244px"
              style="fill: rgb(255, 255, 0); stroke: rgb(0, 0, 0); "
              height="13.662px"/>
        <text style="white-space: pre; fill: rgb(0, 0, 0); font-size: 12; font-
family: &quot;Arial&quot;; baseline-shift: 22%; text-anchor: start;">
            <tspan x="90.0px" y="120.0px">
                Dies sind   3 Leerzeichen!
            </tspan>
        </text>
    </g>
</svg>

Example 2:

<?xml version="1.0" encoding="iso-8859-1"?>

<svg contentScriptType="text/ecmascript" zoomAndPan="magnify"
     xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css"
     version="1.0" width="100%" preserveAspectRatio="xMidYMid meet"
     viewBox="0.0 -0.0 297.0 210.0" height="100%"
     xmlns="http://www.w3.org/2000/svg">
    <line y2="180.0px"
          style="fill: none; stroke: rgb(0, 0, 0); stroke-dasharray: 20 0; "
          x1="90.0px" x2="90.0px" y1="50.0px"/>
    <line y2="120.0px"
          style="fill: none; stroke: rgb(0, 0, 0); stroke-dasharray: 20 0; "
          x1="40.0px" x2="150.0px" y1="120.0px"/>
    <g>
        <rect x="90.0px" y="106.338px"
              width="134.244px"
              style="fill: rgb(255, 255, 0); stroke: rgb(0, 0, 0); "
              height="13.662px"/>
        <text style="fill: rgb(0, 0, 0); font-size: 12; font-family: 
&quot;Arial&quot;; baseline-shift: 22%; text-anchor: start;">
            <tspan x="90.0px" y="120.0px" xml:space="preserve">
                Dies sind   3 Leerzeichen!
            </tspan>
        </text>
    </g>
</svg>

Received on Friday, 4 July 2008 09:02:58 UTC