Re: [xsl] nested output

Subject: Re: [xsl] nested output
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Tue, 21 Dec 2004 11:37:00 -0500
On Dec 21, 2004, at 11:12 AM, David Carlisle wrote:

?? the result you posted had no latex markup at all

oops :-)


(and does have a couple of strange characters (octal 226, decimal 150)
just after each page number, is that intended to be a dash of some
sort?

It displays fine in my mail program as an en-dash. I don't intend to deal with tex-escaping and such; just utf-8.

something like

   <xsl:template match="xhtml:span" mode="output-latex">
     <xsl:variable name="c" select="tokenize(@class, ' +')">

         <xsl:if test="$c='italic'">\textit{</xsl:if>
         <xsl:if test="$c='bold'">\textbf{</xsl:if>

<xsl:apply-templates/>

         <xsl:if test="$c='italic'">}</xsl:if>
         <xsl:if test=".='bold'">}</xsl:if>
 </xsl:template>

OK, thanks! Had a feeling it was easier than I was thinking!


David, you have background in TeX.  Do you have any thoughts about the
best design approach to this intermediate (xhtml) representation to
make output transformation to other targets easiest?

The basic options are:

1) Keep as is:

<span class="title bold italic">Riots and Pogroms</span>

2)  Split presentation from semantics, and embed the former in the
element; like:

	<span class="title" style="font-weight: bold; font-style:
italic;">Riots and Pogroms</span>

The latter approach would require some rethinking of the code.  Current
templates look like:


<xsl:template match="mods:titleInfo[not(@type='abbreviated')]" mode="full"> <xsl:param name="prefix" /> <xsl:param name="suffix" /> <xsl:param name="font-style" /> <xsl:param name="font-weight" /> <xsl:value-of select="$prefix" /> <xsl:choose> <xsl:when test="../../bib:refclass='part-inSerial' and not(../../mods:name)" /> <xsl:otherwise> <span class="title {$font-style} {$font-weight}"> <xsl:apply-templates select="mods:title" /> <xsl:apply-templates select="mods:subTitle" /> </span> <xsl:value-of select="$suffix" /> </xsl:otherwise> </xsl:choose> </xsl:template>

Perhaps a bib:style() function?

Incidentally, I'm realizing that XSLT 2.0's unparsed-text() functions
and reg-exp support means that this could theoretically be extended to
handle TeX input documents.

Bruce

Current Thread