[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] saving nodes for later output


Subject: RE: [xsl] saving nodes for later output
From: "David Santamauro" <david.santamauro@xxxxxxxx>
Date: Sat, 3 Nov 2001 13:08:36 -0500

Trevor, thank you very much. Your help is much appreciated.

> BTW I think your XML would be better expressed something like this:
> <tab>
>  <row>
>   <cell id="1">Text with a footnote.<footnote
> mark="*">This is the text referred to in cell
> id="1"</footnote></cell>
>   <cell id ="2">More text...</cell>
>  </row>
>  <row><cell id="3">&nbsp;</cell></row>
>  <row><cell id="4">&nbsp;</cell></row>
> </tab>

I agree, but unfortunately I have no control over the XML I am dealing with.

I just tried it and the main idea works. The footnote boby is now outside
the table. There is one problem. When I set up empty templates
mode="footnotes", the footnote body disappears. When I comment those empty
templates out, the text content of the table is repeated.

Here is my incoming XML:

<tab>
<row>
<cel al="l">Clone </cel>
<cel al="c">Rev
	<for fnref="56.1"><sp pos="post">a</sp></for>
</cel>
<cel al="c">Phosphorylation
	<for fnref="56.2"><sp pos="post">b</sp></for>
</cel>
<cel al="c">Sub-cellular
	<for fnref="56.3"><sp pos="post">c</sp></for>
</cel>
</row>
<row>
<cel al="l">?13/14</cel>
<cel al="l">++</cel>
<cel al="l">++</cel>
<cel al="l">N
	<foo fn="56.1"><sp pos="post">a</sp>++, 50-100 % etc...</foo>
	<foo fn="56.2"><sp pos="post">b</sp>++, comparable etc... </foo>
	<foo fn="56.3"><sp pos="post">c</sp>?, not detected etc...</foo>
</cel>
</row>
</tab>

****
and the simple style sheet dealing with tables:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="cel">
		<td class="table-data"><xsl:apply-templates /></td>
	</xsl:template>
	<xsl:template match="row">
		<tr><xsl:apply-templates/></tr>
	</xsl:template>
	<xsl:template match="tch">
		<td class="table-data"><xsl:apply-templates /></td>
	</xsl:template>
	<xsl:template match="tsb">
		<td class="table-data"><xsl:apply-templates /></td>
	</xsl:template>
	<xsl:template match="tsh">
		<td class="table-data"><xsl:apply-templates /></td>
	</xsl:template>
	<xsl:template match="tti">
		<td class="table-data"><xsl:apply-templates /></td>
	</xsl:template>
	<xsl:template match="tab">
		<table border="0" width="90%">
			<caption><xsl:value-of select="@id"/></caption>
			<xsl:apply-templates/>
		</table>
		<xsl:apply-templates mode="table-footnotes"/>
	</xsl:template>

	<xsl:template match="cel" mode="table-footnotes">
		<!-- do nothing -->
	</xsl:template>
	<xsl:template match="row" mode="table-footnotes">
		<!-- do nothing -->
	</xsl:template>
	<xsl:template match="tch" mode="table-footnotes">
		<!-- do nothing -->
	</xsl:template>
	<xsl:template match="tsb" mode="table-footnotes">
		<!-- do nothing -->
	</xsl:template>
	<xsl:template match="tsh" mode="table-footnotes">
		<!-- do nothing -->
	</xsl:template>
	<xsl:template match="tti" mode="table-footnotes">
		<!-- do nothing -->
	</xsl:template>


	<xsl:template match="foo">
		<!-- do nothing -->
	</xsl:template>
	<xsl:template match="foo" mode="table-footnotes">
		<br/><a name="footnote_{@fn}"><xsl:apply-templates/></a>
	</xsl:template>

	<xsl:template match="for">
		<a href="#footnote_{@fnref}">
			<xsl:apply-templates/>
		</a>
	</xsl:template>
</xsl:stylesheet>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
xml