Re: [xsl] xml->xsl->pdf

Subject: Re: [xsl] xml->xsl->pdf
From: Peter Flynn <peter@xxxxxxxxxxx>
Date: Thu, 7 Jun 2001 22:49:04 +0100
On Thu, 07 Jun 2001, Joern wrote:
> So, from
> 
> <TR>
>    <TD>a &amp; b</TD>
>    <TD>c &amp; d</TD>
> </TR>
> 
> I'd like to generate
> 
>  a \& b & c\& d \\
> 
> inside a tabular environment. 

Declare <!ENTITY amp "\&#38;"> and then write

<xsl:template match="TR">
   <xsl:apply-templates/>\\
</xsl:template>

<xsl:template match="TD">
   <xsl:if test="count(preceding-sibling::TD)&gt;0">
      &#38;
   </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
&amp; (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


Current Thread