xsl-list
[Top] [All Lists]

Finding and promoting footnotes

2005-11-29 20:35:03

Hi

I have a set of input documents which contain footnote elements at the very
end of the document with forward references in <A> elements at the points in
the document where they are relevant. I am trying to refactor these
documents and one of the necessary changes is to "promote" the footnote so
that its content is local to the item which references it.

A typical input XML file will have pieces like these:

------------------------------------------
a. at various points in the document:
  <ROW>
  <TD>
  <Cell>Format<A href="#id(abcdefg)" xml:link="simple"
    show="replace" actuate="user"
    CLASS="footnote">1</A>
  </Cell>
  </TD>
  ...
  </ROW>

b. and at the end of the document:
  <FOOTNOTES>
  <FOOTNOTE>
  <TableFootnote>
  <A ID="abcdefg"></A>
  Assuming standard configuration is selected.</TableFootnote>
  </FOOTNOTE>
  <FOOTNOTE>
  <TableFootnote>
  <A ID="hijklmn"></A>
  Assuming jiggery pokery configuration has been set.</TableFootnote>
  </FOOTNOTE>
  ...
  </FOOTNOTES>
------------------------------------------

I am attempting to merge the footnotes into the body of the document, giving
something like the following result:

------------------------------------------
  <ROW>
  <TD>
  <Cell>Format
  <footnote>Assuming standard configuration is selected.</footnote>
  </Cell>
  </TD>
  ...
  </ROW>
------------------------------------------

My XSL templates include:

------------------------------------------
<!-- Footnotes -->
<xsl:template match="A[(_at_)CLASS='footnote']">
<xsl:variable name="fnr"><xsl:value-of select="substring-after(@href,'(')"
/></xsl:variable>
<xsl:variable name="fid"><xsl:value-of select="substring-before($fnr,')')"
/></xsl:variable>
<xsl:apply-templates select="/XML/FOOTNOTES" mode="body" />
</xsl:template>

<xsl:template match="FOOTNOTES: mode="body">
<xsl:for-each select="FOOTNOTE">
<xsl:if test="*/A[(_at_)ID={$fid}]">
<footnote>Test footnote matching: <xsl:apply-templates /></footnote>
</xsl:if>
</xsl:for-each>
</xsl:template>

<xsl:template match="FOOTNOTES"></xsl:template>
------------------------------------------

It's the test immediately before <footnote>..</footnote> that is giving me
trouble. What is the recommended way to process this so that the content of
the single FOOTNOTE which contains an <A ID="x"> which matches the document
body's <A href="id(x)"> is output here?

This could well be an FAQ but if so, not under the keywords I tried!

Thanks in advance
Trevor



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>