How to convert xml to....

How to convert xml to pdf?
How to convert xml to html?
How to convert xml to forum BB code?
Are there any simple utils to do that in ports?
Regarding XML to PDF, it depends - does the xml itself contain formatting instructions (that is, it has tags like <color="red">), or does it contain random tags that you want to do things with (e.g. if the tag is <manufacturer> you want to make the content a header), or do you just want to highlight and indent it?

If it's the last case (you want to the pdf to contain the same xml, just prettyprinted), you might be able to do something with enscript.
In the middle case, you can write a small stylesheet (in CSS) describing what you want, then filter it through a rendering engine. I'm not actually sure what's the best alternative for that, though - scripting a copy of konqueror to render it for you is perfectly doable, but feels very unelegant. I honestly have no idea if CUPS can render XML+CSS to pdf, but it might be worth looking into.
In the first case, you might be best off using a script to transform it into xhtml and then rendering that to a pdf - though as in the previous case, I'm not sure how.

I should mention that there is one commandline xml+css / xhtml+css to pdf tool that keeps showing up in my searches, but it's proprietary and requires licencing for anything other than singleuser testing. If it's still interesting, search for PrinceXML.
Ah, I knew I was overlooking something.
You can write an XSLT transform to create XSL-FO code from your XML documents, then run that through xmlroff (textproc/xmlroff) or apache FOP (textproc/fop) to create a PDF. Of course, you need to learn XSLT and XSL-FO ...

You'll need something to apply the XSLT as well, such as xsltproc from textprox/libxslt.

For XHTML to pdf, there are premade XSLTs that can transform it to XSL-FO.
If you prefer, you can use an XSLT to transform any XML into XHTML, as well - but you'll have to write it yourself.

Oh, and don't take this as absolute facts - I've never used half of this.
Oh, and the reason there's no simple tool for this in ports is that we have no idea how your XML looks - it could be anything. ;)

On a somewhat related note, converting XML to BB-code is one of those things you'll have to write yourself, unless there's some "BB-code as XML"-spec out there that you're using.
Thanks.... i thought so....
xml is such a format *makes me creeps*

is there any standardized (and easy to learn) format, that could be used instead
It's just a way of packaging data, really.
What to replace it with, if anything, depends on what the data is.
killasmurf86 said:
How to convert xml to html?
How to convert xml to forum BB code?
I use XML to write my guides, mostly OpenBSD related, that is why you won't find them here ;)

To transform XML into another format, you use an XSLT stylesheet. One stylesheet creates XHTML, another stylesheet creates VBulletin code.

At the end of my (OBSD)guide at you see two RCS identifiers
$Id: USBusermounting.xml,v 1.3 2008/10/23 00:23:08 j65nko Exp $
$Id: vbul-html.xsl,v 1.14 2008/09/12 03:44:16 j65nko Exp $
The source file is USBusermounting.xml, while the XSL stylesheet vbul-html.xsl produces Vbulletin code.

If you would download the XHTML version of this guide you would see the following RCS Id tags:
$Id: USBusermounting.xml,v 1.3 2008/10/23 00:23:08 j65nko Exp $
$Id: howto.xsl,v 1.17 2008/09/11 02:32:15 j65nko Exp $
The first tag is the same USBusermounting.xml XML source. The second one, howto.xsl, identifies the stylesheet that transformed the XML into XHTML.

You could roughly compare an XML document as C source code.
The same C code document used to produce opcodes for the 32 bit i386 processor, can also be used to generate 64 bit instructions for amd64 processor by using another compiler or compiler switch.

The wikepdia XSLT article explains more about these tranformations :

Something similar can be done with SGML and DSSL stylesheets.
The FreeBSD project uses Docbook SGML to maintain and produce different output formats of the FreeBSD handbook. See
btw, for www/ we use XML together with XSLT too :)
Just out of curiosity, have either of you tried the XSL-FO -> PDF tools?
It looks like it could be useful (filter it through yet another XSLT and another commandline tool, and get a decent pdf). :)