Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Line Break in Item ID

Status
Not open for further replies.

axLW

Programmer
Feb 6, 2015
110
0
0
GB
Hello all, first time poster.

I am trying to create a line break in an XML item id.
I'm using a popular 'off the shelf' software package and I am limited as to what changes I can make.

My website is hosted on Windows Server 2003.

The file is called CCBranding.config:

At the top of the file:

Code:
<?xml version="1.0" encoding="utf-8"?>

Where I need the line break:

Code:
<item id="SALOON CAR (Standard Class)" type="listitem" img="any_vehicle.png">

I want a line break in between the words 'SALOON CAR' and (Standard Class), so it displays like this on the browser:

SALOON CAR
(Standard Class)


The company that wrote the software told me it's not possible, but I'm sure there must be a way to do it.

I have tried using <br> and /n but all that does is place that exact string amongst the text. I have also tried using &#x13&#x10; as suggested on the following: Link but what that actually does is ruin the whole code and the page doesn't display properly.

I have also tried actually placing the two strings on separate lines within the code itself but it ignores the line break and just places the two strings next to each other.

Can anybody here suggest something else to try, or is it simply not possible to place a line break inside an id?

I cannot really go into too much detail as to how the code translates to the final website, but for sure, this is the only instance in the code where I'm able to attempt a line break so any suggestions would be welcome.

Thanks




 
Welcome to Tek-Tips.

There are rules in the XML specification for the values of attributes. Furthermore, the XML parser is required to normalize the value in a way that might render anything you try pointless.

Certainly &#x13; and &#x10; are not the character entities that you want; try instead &#xD; and &#xA;. Note however that the page you reference is placing these values into a XML element value, not an attribute value. The XML Specification has different rules for element and attribute values, and embedded whitespace in element values is easier to preserve.

If the translation is being accomplished using XSLT, then it would be possible to make a special rule (template) for accomplishing your goal. But absent other details, one cannot simply state, "Here is your solution."

Tom Morrison
Hill Country Software
 
Thank you for the reply:

&#xD; AND &#xA; - these two placed on their own or placed together do not corrupt the code but they don't affect the line at all. no line break, no extra space or anything. It's like they aren't even there.

The code outputs to HTML like this:

Code:
<div vtid="SALOON CAR (Standard Class)"  id="SALOON CAR (Standard Class)" class="percar notSeleced" style="width:140px; height:220px; margin-left:  11px ; display:inline;">  
                    <div class="price-status-wrap" style="width:100%;">
                        <div id="left-price" style="float:left;">
                            <div class="clear "><strong>SALOON CAR (Standard Class)</strong></div>

Not sure what else I can tell you..
 
This is not a surprising result. Depending on the way that the attribute id is defined, this would be expected. A conforming XML parser, for most attributes, would eliminate them - so they are not there in the output to the application.

Do you know if this HTML is being created by XSLT or by some other process? If XSLT, it might be possible to get what you wnat. But it might simply be easier to live with what the application can do right now...



Tom Morrison
Hill Country Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top