Problem with xml/xsl rendering

wxdqz

New Member
Hi Guys,

Any help to resolve my issue below would be deeply and immensely appreciated.

Not sure whether my problem is related to XML/XSL rendering or HTML related.

I am using an xml document and xsl document to render the html page. Everything is working fine but for one thing.....
I have a main page where i show the list of entities with some details like id, name, etc. Each have a link to go inside and view the complete details of each entity. Now my problem is with the rendering of element Name on this main page. Since the Name field cannot hold more than 35 characters I have a xsl script which cuts the Name field upto 30 characters and displays it like "MyentityForDisplayToAllBuddies...". Now if the name is such as "728x90_09-12_ha_acqui_lgvx3450(lp).swf" it will not display it as "728x90_09-12_ha_acqui_lgvx3450..." but is displayed as "728x90_09-" with the rest in the next line. I have not able to get the exact reason why this is happening. I tried out different options like the following and got different results everytime.

AAAA-DFBERWEGEWREWWERWERWEREWRWERWE as AAAA- and remaining DFBERWEGEWREWWERWERWEREWR... in the next line.

AAAA-dfberwegewrewwerwerwerewrwerwe as AAAA- and remaining dfberwegewrewwerwerwerewr... in the next line.

aaaa-dfberwegewrewwerwerwerewrwerwe as aaaa-dfberwegewrewwerwerwerewr ...

1234-ABCDEFGHIJKLMNOPQRSTUVWXYZ as 1234- and remaining ABCDEFGHIJKLMNOPQRSTUVWXY ... in the next line.

1234-1244634573458573453465783457345345 as 1234- and remaining 1244634573458573453465783 ... in the next line.

1234-abcdefghijklmnopqrstuvwxyz as
1234-abcdefghijklmnopqrstuvwxy ...


As you can see the line breaks after -(hyphen character) and does so if the subsequent string has capital letters or numbers and is long enough that can not be fit within the width of the Name field.
i.e if the first string is AAAA-DFBERWEGEWREWWDGEWR it is displayed completely.

My code is as follows :

<xsl:attribute name="class">
<xsl:eval>getStyleSheet("left");</xsl:eval>
</xsl:attribute>
<xsl:attribute name="style">
<xsl:eval>styleStringWithNodePattern(this, ".//@dart:action", 0, 0, 178, 0);</xsl:eval>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:eval>truncateElementText(this, "Name")</xsl:eval>
</xsl:attribute>
<xsl:eval>truncateElementText(this, "Name")</xsl:eval>

where

function styleStringWithNodePattern(node, pattern, left, top, width, height, bUpdateTop)
{
var string = styleString(left, top, width, height, bUpdateTop);
attribValue = node.selectSingleNode (pattern);
if (attribValue != null)
string += "COLOR: blue;";
return string;
}

and

function truncateElementText(n, strName)
{
objName = n.selectSingleNode(strName);
tempString = objName.text;
count = tempString.length;
if (count > 30)
return tempString.substr(0,30) + " ...";
else
return tempString;
}

Note that i have changed the following code
<xsl:attribute name="title"><xsl:eval>truncateElementText(this, "Name")</xsl:eval>
</xsl:attribute>
to include the function call here so that when i mouse over the name , i get to see what the function is returning and the function is working just fine i.e it is returning the proper string with ... appended in all the above cases.
The original code is
<xsl:attribute name="title"><xsl:value-of select="Name"/></xsl:attribute>

I have tried the overflow:hidden; and nowrap:true properties but they do not help.

Thanking you guys in advance.

Regards,
Ravindran.
 
Back
Top