How do I typeset from an XML data file? #1461
-
Let's say I have a bunch of structured content according to some XML schema I've only ever tried SILE in TeX mode How do I typeset XML? Should I convert the XML to SILE TeX? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Your two choices are
If the data is a jumble of knick knacks doing the former with an XML preprocessor might make sense. Otherwise for most cases The latter approach is suggested. The existing docbook class is an example of that approach. |
Beta Was this translation helpful? Give feedback.
-
No you do not have to convert XML to SIL-language. SILE comes with XML parsing natively, though of course the elements need to be supported by appropriate commands. E.g. if you have a The way I've done it is:
As of working examples, in my repo --still on SILE 0.12.5-- you can possibly check
N.B. This is, as far as I recall, the route described in the manual chapter devoted to XML processing with SILE. This does work without much pain, as long as the XML element names don't overlap with existing commands from your supporting packages or from SILE's base classes... (That's a thing we'd need to address, sooner or later, but I was not in that case though didn't bother for now. Another thing we might want to address is that ill-named xmltricks packages, which could be improved IMHO -- but these are separate considerations anyhow). |
Beta Was this translation helpful? Give feedback.
No you do not have to convert XML to SIL-language.
SILE comes with XML parsing natively, though of course the elements need to be supported by appropriate commands. E.g. if you have a
<sometag>blah</sometag>
in your XML, you need asometag
command/environment to be provided and implement something.The way I've done it is: