Question:
How do I format text in an XML file?
Alex
2007-05-03 21:38:06 UTC
Hi there, I am working on an XML file, very new to this. I need to change the font size and add bullets to some text. Whenever I use the regular HTML commands they don't work. Is there a specific set of commands I need to use in order to do that on an XML file?

Thanks.
Five answers:
jake cigarâ„¢ is retired
2007-05-03 22:45:43 UTC
with an xml file, you need a stylesheet written in xsl.



otherwise you may want xhtml or html!

by adding the line



you can convert the xml so it can be read by a browser or publishing engine. (pdf generator).
planetmatt
2007-05-04 04:57:00 UTC
XML is just a way of storing interchangable data in a text file. It is only concerned with the content and meaning of the data and not its presentation.



To display XML, you can do it in two ways. The first is to just link to a CSS file at the top of the XML file:







You can then use the CSS file to specify how the XML will be presented. For example if you have an XML tag called Customer, you could style it like this in the css file:



customer{font-family:serif; color:blue;}



This would change the font to a serif font and make the text blue for any content held between the customer tag. The CSS is only able to style existing tags in the XML so to add bullet points (
    ) or any other standard HTML tags you have to create an XML transformation file called an XSL file.



    The XMl file links to the XSL file like this at the top of the XML file:







    You can then put any HTML tags you like in the xsl file. To pull in your XML data you use special xsl tags like this:



      --start bullet point list

      --for every customer in xml file

    • --display an html bullet point

      --show customer name from xml file

    • --end of html bullet point

      --end of looping through customers

    --end of html bullet point list



    If you do it like this, you can then also link the XSL file to the CSS file to style everything all together.



    It is tricky at first but take a look at W3Schools for an excellent tutorial: http://www.w3schools.com/xml/xml_xsl.asp
unknownablemass
2007-05-03 22:48:54 UTC
Here is the deal:

HTML tags don't work in XML In order to convert your XML to HTML you need to transform it using an XSLT. Google, XSLT and you will find a lot of resources about this transformation. It's tough to write an XSLT but I am sure will find some source code somewhere.
ancar08back
2007-05-03 22:31:24 UTC
Hello

Talented Gave you a website at which you find the tutorials you will need. Also try these:



http://www.w3.org

http://www.xml.com
anonymous
2007-05-03 21:45:13 UTC
http://www.w3schools.com/


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...