Subject: [xsl] nested output From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx> Date: Tue, 21 Dec 2004 10:28:44 -0500 |
Now that I got the other output modes working, I need to figure out how to convert this:
<span style="font-weight: bold; font-style: italic;">Riots and Pogroms</span>
<p class="bibref" id="TimesP2001a"><span class="creator">Times</span> (<span class="year">2001</span>) <span class="title ">Senators Stamp OK on Anti-Terrorism Laws</span>, <span class="container"><span class="origin"></span><span class="part-details">October26, <span class="pages"> pp. A01</span></span></span>.</p> <p class="bibref" id="Veer1996a"><span class="creator">van der Veer, P. </span> (<span class="year">1996</span>) <span class="title ">Riots and Rituals: The Construction of Violence and Public Space in Hindu Nationalism</span><span class="container">, In P. BrassEd., <span class="title italic ">Riots and Pogroms</span><span class="origin"> (<span class="place">New York</span>:<span class="publisher">NYU Press</span>) </span><span class="part-details"><span class="pages"> pp. 15476</span></span></span>.</p>
Times (2001) Senators Stamp OK on Anti-Terrorism LawsSenators Stamp OK on Anti-Terrorism LawsSenators Stamp OK on Anti-Terrorism Laws, October 26, pp. A01.
van der Veer, P. (1996) Riots and Rituals: The Construction of Violence and Public Space in Hindu NationalismRiots and Rituals: The Construction of Violence and Public Space in Hindu NationalismRiots and Rituals: The Construction of Violence and Public Space in Hindu Nationalism , In P. Brass Ed., Riots and Pogroms (New York:NYU Press) pp. 15476.
<xsl:template match="xhtml:span" mode="output-latex"> <xsl:variable name="content" select="."/> <xsl:for-each select="tokenize(@class, ' ')"> <xsl:variable name="css-class" select="."/> <xsl:choose> <xsl:when test="$css-class='italic'"> <xsl:text>\textit{</xsl:text> <xsl:value-of select="$content"/> <xsl:text>}</xsl:text> </xsl:when> <xsl:when test="$css-class='bold'"> <xsl:text>\textbf{</xsl:text> <xsl:value-of select="$content"/> <xsl:text>}</xsl:text> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="$content"/> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:template>
I should add I'm seriously contemplating switching the style handling (per Wendell's suggestion awhile back) to split the presentation into the style attribute, and keep the class attribute semantic. I haven't done that yet, but if it would be easier for the above issue, I can do that.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Changing an html colour v, David Carlisle | Thread | Re: [xsl] nested output, David Carlisle |
Re: [xsl] Changing an html colour v, David Carlisle | Date | Re: [xsl] Translating roman numeral, António Mota |
Month |