This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xml->xsl->pdf
On Thu, 07 Jun 2001, Joern wrote:
> So, from
>
> <TR>
> <TD>a & b</TD>
> <TD>c & d</TD>
> </TR>
>
> I'd like to generate
>
> a \& b & c\& d \\
>
> inside a tabular environment.
Declare <!ENTITY amp "\&"> and then write
<xsl:template match="TR">
<xsl:apply-templates/>\\
</xsl:template>
<xsl:template match="TD">
<xsl:if test="count(preceding-sibling::TD)>0">
&
</xsl:if>
<xsl:apply-templates/>
</xsl:template>
But you'll have to do it with a validating parser, because I
don't think a non-validating one will honour a [re]definition of
& (because it's pre-declared for DTDless operations, and
only the first declaration of entities gets honoured).
> String replacement is a way to go, and
> with appropriate mappings in a repository like XSLTSL for example a good
> one. I just thought that an output method would make things a little bit
> easier.
It certainly would, pace Sebastian's comments about TeX systems
which process XML direct...I like being able to use the tree
manipulation abilities of XSLT in order to generate my LaTeX,
but I do think what Sebastian and David have done getting TeX to
read XML and XSL may be more viable in the long term.
///Peter
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list