https://github.com/cran/XML
Tip revision: 44649fca9d41fdea20fc2f573cb516f2b12c897e authored by CRAN Team on 19 March 2023, 10:04:35 UTC
version 3.99-0.14
version 3.99-0.14
Tip revision: 44649fc
xml2tex.Sxml
<?xml version="1.0"?>
<!DOCTYPE SSource SYSTEM "/home/duncan/Projects/org/omegahat/XML/RS/examples/SSource.dtd"
[
<!ENTITY lt "<" >
<!-- Temporarily use _ rather thant <- as it screws things up. -->
<!ENTITY sgets "<-" >
<!ENTITY Latex "LaTex" >
]>
<!--
We can define sgets here and avoid validation
forced by reading the DTD to get these entities.
[ <!ENTITY sgets "<-">
]>
-->
<SSource>
<overview>
The functions in this file are an initial attempt to define some
filters for an XML document to produce &Latex; output by translating
the contents of the XML document.
Note that using XSL is slightly problematic because the result needs
to be a valid XML document, which no &Latex; document ever is.
</overview>
<function lang="S">
<sname>xml2tex</sname>
<def>
function(node, mappings=.XMLTexMappings) {
n &sgets; 10
x &sgets; <fragmentRef id="frag1" />
print(x+10)
x
}
</def>
</function>
<expression>
cat("Got to here\n")
</expression>
<?R cat("A processing instruction\n") ?>
<function>
<sname>xml2texUnderline</sname>
<def>
function(node, tex)
{
}
</def>
</function>
<function>
<def>
xml2texCode &sgets;
function(node, tex)
{
}
</def>
</function>
<function lang="SPlus">
<sname>xxx</sname>
<def>
<![CDATA[
x &sgets; 1
]]>
</def>
</function>
<fragment id="frag1">
seq(1,n)
<fragmentRef id="frag2" />
</fragment>
<fragment id="frag2">
+ 10
</fragment>
<Sexpression>
xml2tex.map &sgets;
list("i"="textit",
"b"="textbf",
"sfunction"="SFunction",
"item"="item",
"label"=c("[", "]"),
"cite"=function(x) { paste("\cite{", xmlAttrs(x)["id"], "}", collapse="")},
"bibitem"="",
"bibliography"=""
)
</Sexpression>
<function>
<sname>mapXML2TeX</sname>
<def>
function(node, attr) {
name &sgets; xmlName(node)
el &sgets; xml2tex.map[[name]]
if(!is.null(el)) {
if(mode(el) == "character") {
} else if(mode(el) == "function") {
el(node)
}
}
}
</def>
</function>
</SSource>