Simon
Simon

Reputation: 23141

align="right" doesn't work in XML

I've never used XML before, and now I must change the align of text. I try to do it like in HTML, but it doesn't happen. Maybe I do something wrong? Here is he script:

<gallery>
    <title><![CDATA[<FONT SIZE="20" COLOR="#C3A25D"></FONT>]]></title>
    <text><![CDATA[<FONT SIZE="20" COLOR="#C3A25D">text, which i want to to be in right position</FONT>]]></text>
    <thmb></thmb>
    <img wdt="421">images/avetiskhakhamyan.jpg</img>
</gallery>

I try to write align="right" in <font> tag, but it deosn't work. Could you tell me what is the problem?

Update:

And I can't understand anyway, if I don't set any align attribute, why it show text in center? is it the default value?

Upvotes: 2

Views: 29150

Answers (4)

user1982909
user1982909

Reputation: 11

<Paragraph>
    <TextRuns>
        <TextRun>
             <Value>=Parameters!rpReportSubHead1.Value</Value>
             <Style>
                 <FontWeight>Normal</FontWeight>
             </Style>
        </TextRun>
    </TextRuns>
    <Style>
        <TextAlign>Right</TextAlign>
    </Style>
</Paragraph>

Upvotes: -1

Donal Fellows
Donal Fellows

Reputation: 137587

Plain XML? You need to apply a stylesheet to it, and that should be the part that identifies how to display the tag. Alignment is entirely part of display.

You can ask the browser (i.e., I've tested it with Safari and Firefox) to apply an XSLT stylesheet by adding a processing instruction to the XML document – usually immediately below the <?xml…?> declaration – which can do things like changing the document to XHTML (which can support alignment control):

<?xml-stylesheet type="text/xml" href="http://example.com/wherever.xsl"?>

You might also be able to get away with just telling the browser what to do by applying a CSS stylesheet:

<?xml-stylesheet type="text/css" href="http://example.com/wherever.css"?>

Ask further questions here if you need help learning how to use CSS, XSLT, or XHTML.

Upvotes: 2

Arve Systad
Arve Systad

Reputation: 5479

XML exists purely to describe and contain data. Presentation (colors, positioning, fonts etc.) is not part of what XML can or should be able to do.

You should take a look at XLST (and therefore too HTML and CSS). That way you can format your data the way you want.

Upvotes: 2

Oded
Oded

Reputation: 499012

XML is not a display format. It doesn't not "understand" alignments.

As far as XML is concerned, align="right" is an attribute named align with the value right. Noting more and nothing less.

Upvotes: 12

Related Questions